Compartir a través de


Error del compilador C2933

'class': type-class-id se redefinió como un miembro typedef de 'identifier'

No puede usar una clase genérica o de plantilla como miembro typedef.

Este error está obsoleto en Visual Studio 2022 y versiones posteriores.

El ejemplo siguiente genera la advertencia C2933:

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

struct TC2 { };
struct MyStruct2 {
   typedef int TC2;
};

El error C2933 también puede producirse al usar genéricos:

// C2933b.cpp
// compile with: /clr /c
generic<class T> ref struct GC { };
struct MyStruct {
   typedef int GC<int>;   // C2933
};

ref struct GC2 { };
struct MyStruct2 {
   typedef int GC2;
};