Compiler Error C2971
'class' : template parameter 'param' : 'arg' : a local variable cannot be used as a non-type argument
You cannot use the name or address of a local variable as a template argument.
The following sample generates 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;
}
Athugasemdir
https://aka.ms/ContentUserFeedback.
Væntanlegt: Á árinu 2024 munum við hætta með GitHub-mál sem ábendingaleið fyrir efni og skipta því út fyrir nýtt ábendingakerfi. Frekari upplýsingar er að finna hér:Senda inn og skoða endurgjöf fyrir