RAD Studio |  |

E2392: Template instance 'template' is already instantiated (C++)

There are two ways to trigger this error. If –A is enabled (ANSI compliant mode), then attempting to explicitly instantiate a template specialization which has already been instantiated (either implicitly or explicitly) will cause this error. Regardless of –A, attempting to explicitly specialize a template specialization which has already been either implicit or explicitly instantiated will always trigger this error. For example:

Copy Code

    template<class T>
    class foo;
    foo<char> x;     // causes implicit instantiation of "foo<char>"
    template<>
    class foo<char> { };   // error: "foo<char>" already instantiated
    template class foo<char>;   // error in –A mode, otherwise a warning

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