fork download
  1. const int list[3] = { 2, 5, 7 };
  2. const int a = list[2];
  3.  
  4. template<int N1, int N2>
  5. struct tmax {
  6. enum { value = ((N1 > N2) ? N1 : N2) };
  7. };
  8.  
  9. const int b = tmax<2,4>::value;
  10. const int c = tmax<list[0],list[1]>::value;
  11.  
  12. int main()
  13. {
  14. return 0;
  15. }
Compilation error #stdin compilation error #stdout 0s 2924KB
stdin
Standard input is empty
compilation info
prog.cpp:10:24: error: 'list' cannot appear in a constant-expression
prog.cpp:10:30: error: an array reference cannot appear in a constant-expression
prog.cpp:10:32: error: 'list' cannot appear in a constant-expression
prog.cpp:10:38: error: an array reference cannot appear in a constant-expression
prog.cpp:10:39: error: template argument 1 is invalid
prog.cpp:10:39: error: template argument 2 is invalid
stdout
Standard output is empty