Condividi tramite


Errore del compilatore C2937

'class': type-class-id ridefinito come typedef globale

Non è possibile usare una classe generica o modello come un oggetto globale typedef.

Questo errore è obsoleto in Visual Studio 2022 e versioni successive.

L'esempio seguente genera l'errore C2937:

// C2937.cpp
// compile with: /c
template<class T>
struct TC { };
typedef int TC<int>;   // C2937
typedef TC<int> c;   // OK

C2937 può verificarsi anche quando si usano i generics:

// C2937b.cpp
// compile with: /clr
generic<class T>
ref struct GC { };
typedef int GC<int>;   // C2937
typedef GC<int> xx;   // OK