fork(7) download
  1. template <int N>
  2. void f()
  3. {
  4. N = 42;
  5. }
  6.  
  7. template <int const N>
  8. void g()
  9. {
  10. N = 42;
  11. }
  12.  
  13. int main()
  14. {
  15. f<0>();
  16. g<0>();
  17.  
  18. static const int h = 1;
  19. f<h>();
  20. g<h>();
  21. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
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
stdout
Standard output is empty