RAD Studio |  |

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

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

Copy Code

        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:

Copy Code

        void f(int **)
        {
        }

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!