Article ID: 179273
Article Last Modified on 6/2/2005
/* Compile options needed: none
*/
#include <stdio.h>
class Register {
public:
Register( const char* class_name )
{ printf("In Register ctor for class %s.\n", class_name); }
~Register()
{ printf("In Register dtor.\n"); }
};
template<class T>
class Base {
public:
static Register r;
};
template<class T>
Register Base<T>::r( "Base<T>" ); //Cause of C2059, C2063 and C2040
// To work around the problem, comment the line above and
// uncomment the following line:
// Register Base<T>::r = Register("Base<T>");
int main() {
return 0;
}
Additional query words: initializer
Keywords: kbtshoot kbbug kbfix kbnoupdate KB179273