This documentation is archived and is not being maintained.

Compiler Error C2955

Error Message

'identifier' : use of class type requires type argument list

You cannot use a class template or class generic as an identifier without a template or generic argument list.

For more information, see Class Templates.

The following sample generates C2955:

// C2955.cpp
// compile with: /c
template<class T> 
class X {};

X x;   // C2955
X<int> x2;   // OK

C2955 can also occur when attempting an out-of-line definition for a function declared in a class template:

// C2955_b.cpp
// compile with: /c
template <class T>
class CT {
public:
   void CTFunc();
   void CTFunc2();
};

void CT::CTFunc() {}   // C2955

// OK
template <class T>
void CT<T>::CTFunc2() {}

C2955 can also occur when using generics:

// C2955_c.cpp
// compile with: /clr
generic <class T> 
ref struct GC { 
   T t;
};

int main() {
   GC^ g;   // C2955
   GC <int>^ g;
}
Show: