Article ID: 155420
Article Last Modified on 6/3/2005
ClassA<int, ClassB<int>> iA ;The problem is caused by the consecutive closing chevrons ">>" at the end of the declaration.
ClassA<int, ClassB<int> > iA ;This is not a compiler bug. The language specification requires the space between the two ">"; otherwise, the lexical parser generates the token ">>", which is the largest possible token.
//Compile options needed: none
// test.cpp
template <class T>
class ClassB {} ;
template <class T1, class T2>
class ClassA{} ;
void main()
{
ClassA<int, ClassB<int>> iA; // causes C2146, C2065, C2143
//ClassA<int, ClassB<int> > iA; //workaround
}
Keywords: kberrmsg kbtshoot kbprb kbcpponly kbcompiler KB155420