E2355 Recursive template function: 'x' instantiated 'y' (C++)

From RAD Studio
Jump to: navigation, search

Go Up to Compiler Errors And Warnings (C++) Index

The compiler has detected a recursive template function instance. For example:

    template<class T> void f(T x)
    {
       f((T*)0);   // recursive template function!
    }
    void main()
    {
       f(0);
    }

The compiler issue one message for each nesting of the recursive instantiation, so it is usually obvious where the recursion has occurred. To fix a recursive template, either change the dependencies or provide a specialized version that will stop the recursion. For example, adding the following function definition to the above program will remove the endless recursion:

    void f(int **)
    {
    }