Compiler Error C2989

 

For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

'class' : class type has already been declared as a non-class type

The class generic or template redefines a non-template or non-generic class. Check header files for conflicts.

If you are using class template partial specializations, see Knowledge Base article Q240866.

The following sample generates C2989:

// C2989.cpp  
// compile with: /c  
class C{};  
  
template <class T>  
class C{};  // C2989  
class C2{};  

C2989 can also occur when using generics:

// C2989b.cpp  
// compile with: /clr /c  
ref class GC1;  
  
generic <typename T> ref class GC1;   // C2989  
template <typename T> ref class GC2;  
  
generic <typename T> ref class GC2;   // C2989  
generic <typename T> ref class GCb;  
template <typename T> ref class GC2;  
generic <typename T> ref class GCc;  

Show: