You receive an "INTERNAL COMPILER ERROR" error message when you implement more than one explicit instantiation of member template function (179271)



The information in this article applies to:

  • Microsoft Visual C++, 32-bit Enterprise Edition 5.0
  • Microsoft Visual C++, 32-bit Enterprise Edition 6.0
  • Microsoft Visual C++, 32-bit Professional Edition 5.0
  • Microsoft Visual C++, 32-bit Professional Edition 6.0
  • Microsoft Visual C++, 32-bit Learning Edition 6.0

This article was previously published under Q179271

SYMPTOMS

The error C1001 is produced when more than one explicit instantiation of member template function is implemented. The compiler generates the following error message:
test.cpp(14) : fatal error C1001: INTERNAL COMPILER ERROR

(compiler file 'msc1.cpp', line 1188)
Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information

CAUSE

Member template implementation is not supported in this product.

RESOLUTION

Do not use explicit instantiation for class member template functions.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.

This problem was corrected in Microsoft Visual C++ .NET.

MORE INFORMATION

Steps to reproduce the behavior

The following sample code produces the error message described in the "Symptoms" section.
// test.cpp
#include <iostream.h>
class A
{
public:
  template <class T> int getit(int i , T * it )
  {
     cout << "template getit\n" ;
     return i;
  }
// explicit instantiations
template  int getit(int i, double * it);

template   int getit (int i, char * it);// C1001 error on this line
};

Modification Type:MajorLast Reviewed:9/30/2005
Keywords:kbtshoot kbBug kbCompiler kberrmsg kbfix kbNoUpdate kbtemplate KB179271 kbAudDeveloper