Compilerfehler C2762

Aktualisiert: November 2007

Fehlermeldung

'Klasse': Unzulässiger Ausdruck als Vorlagenargument für 'Argument'
'class' : invalid expression as a template argument for 'argument'

Bei Verwendung von /Za konvertiert der Compiler eine ganze Zahl nicht in einen Zeiger.

Im folgenden Beispiel wird C2762 generiert:

// C2762.cpp
// compile with: /Za
template<typename T, T *pT>
class X2 {};

void f2() {
   X2<int, 0> x21;   // C2762
   // try the following line instead
   // X2<int, static_cast<int *>(0)> x22;
}