Sdílet prostřednictvím


Chyba kompilátoru C2974

neplatný argument typu number, typ byl očekáváno.

Poznámky

Obecný argument nebo argument šablony neodpovídá obecné deklaraci nebo deklaraci šablony. V úhlových závorkách by se měl zobrazit typ. Zkontrolujte obecnou definici nebo definici šablony a vyhledejte správné typy.

Examples

Následující příklad generuje C2974:

// C2974.cpp
// C2974 expected
template <class T>
struct TC {};

template <typename T>
void tf(T){}

int main() {
   // Delete the following 2 lines to resolve
   TC<1>* tc;
   tf<"abc">("abc");

   TC<int>* tc;
   tf<const char *>("abc");
}

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

// C2974b.cpp
// compile with: /clr
// C2974 expected
using namespace System;
generic <class T>
ref struct GCtype {};

generic <typename T>
void gf(T){}

int main() {
   // Delete the following 2 lines to resolve
   GCtype<"a">^ gc;
   gf<"a">("abc");

   // OK
   GCtype<int>^ gc;
   gf<String ^>("abc");
}