Article ID: 130370
Article Last Modified on 7/5/2005
TmpltClass<type> X; // declare a global instance of the class
extern TmpltClass<type> X; // X must be a global defined elsewhere
template TmpltClass<type>; // explicit instantiation
NOTE: Explicit instantiation works only if the template class and all of
its member functions are fully defined.
-or-
/* Compile Options Needed: None
*/
template< class T > class TmpltClass
{
T X;
public:
T& operator*(int Arg1) {return X;}
};
// Workaround 1: uncomment any one of the following three lines:
// TmpltClass<int> X;
// extern TmpltClass<int> X;
// template TmpltClass<int>;
void test(TmpltClass<int>& theArg)
{
// Workaround 2: uncomment the next line:
// theArg.operator*(0);
theArg * 0; //do not comment out this line
}
Additional query words: 2.00 2.10 2.20 9.00 9.10
Keywords: kbbug kbfix kbcpponly kbcompiler KB130370