Sdílet prostřednictvím


Chyba kompilátoru C2921

redefinition: 'class' : class template or generic is being redeclared as 'type'

Poznámky

Obecná třída nebo třída šablony má více deklarací, které nejsou ekvivalentní. Chcete-li tuto chybu opravit, použijte různé názvy pro různé typy nebo odeberte předefinování názvu typu.

Examples

Následující příklad vygeneruje C2921:

// C2921.cpp
// compile with: /c
template <class T> struct TC2 {};
typedef int TC2;   // C2921
// try the following line instead
// typedef struct TC2<int> x;   // OK - declare a template instance

K C2921 může také dojít při použití obecných typů.

// C2921b.cpp
// compile with: /clr /c
generic <class T> ref struct GC2 {};
typedef int GC2;   // C2921
// try the following line instead
// typedef ref struct GC2<int> x;