Article ID: 240866 - Last Review: July 5, 2005 - Revision: 1.1 BUG: ERROR C2989 and C2988 on Class Template Partial SpecializationsThis article was previously published under Q240866 On This PageSYMPTOMS
You may get the following error message if you try to use class template partial specializations:
error C2989: 'A<T,2>' : template class has already been defined as a non-template class
error C2988: unrecognizable template declaration/definition
CAUSE
The compiler does not support class template partial specializations as specified in the C++ Standard (14.5.4.1) quoted here:
1- A primary class template declaration is one in which the class template name is an identifier. A template declaration in which the class template name is a template-id, is a partial specialization of the class template named in the template-id. A partial specialization of a class template provides an alternative definition of the template that is used instead of the primary definition when the arguments in a specialization match those given in the partial specialization (temp.class.spec.match). The primary template shall be declared before any specializations of that template. If a template is partially specialized then that partial specialization shall be declared before the first use of that partial specialization that would cause an implicit instantiation to take place, in every translation unit in which such a use occurs; no diagnostic is required.
Please refer to the C++ Standard section 14.5.4 for more information on this.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. MORE INFORMATIONSteps to Reproduce BehaviorThe following code sample demonstrates the error. | Article Translations
|
Back to the top
