“class”: 模板参数“param”:“arg”: 局部变量不能用作非类型参数
不能将局部变量的名称或地址用作模板参数。
以下示例生成 C2971:
// C2971.cpp
template <int *pi>
class Y {};
int global_var = 0;
int main() {
int local_var = 0;
Y<&local_var> aY; // C2971
// try the following line instead
// Y<&global_var> aY;
}