编译器错误 C2762

“class”: 作为“argument”的模板参数的表达式无效

使用 /Za 时,编译器不会将整型转换为指针。

以下示例生成 C2762:

// 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;
}