Export (0) Print
Expand All
Expand Minimize

Compiler Error C2978

Error Message

syntax error : expected 'keyword1' or 'keyword2'; found type 'keyword3'; non-type parameters are not supported in generics

A generic class was declared incorrectly. See Generics (Visual C++)for more information.

Example

The following sample generates C2978.

// C2978.cpp
// compile with: /clr /c
generic <ref class T>   // C2978
// try the following line instead
// generic <typename T>   // OK
ref class Utils {
   static void sort(T elems, size_t size);
};

generic <int>
// try the following line instead
// generic <class T>
ref class Utils2 {
   static void sort(T elems, size_t size);
};

Community Additions

ADD
Show:
© 2015 Microsoft