template <int N> void f() { N = 42; } template <int const N> void g() { N = 42; } int main() { f<0>(); g<0>(); static const int h = 1; f<h>(); g<h>(); }
Standard input is empty
prog.cpp: In function ‘void f() [with int N = 0]’: prog.cpp:15: instantiated from here prog.cpp:4: error: lvalue required as left operand of assignment prog.cpp: In function ‘void g() [with int N = 0]’: prog.cpp:16: instantiated from here prog.cpp:10: error: lvalue required as left operand of assignment prog.cpp: In function ‘void f() [with int N = 1]’: prog.cpp:19: instantiated from here prog.cpp:4: error: lvalue required as left operand of assignment prog.cpp: In function ‘void g() [with int N = 1]’: prog.cpp:20: instantiated from here prog.cpp:10: error: lvalue required as left operand of assignment
Standard output is empty