fork download
  1. #include <iostream>
  2.  
  3.  
  4. int main()
  5. {
  6. constexpr int i = 42;
  7. int j = 43;
  8.  
  9. constexpr int k { j };
  10. }
  11.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:9:22: error: the value of ‘j’ is not usable in a constant expression
  constexpr int k { j };
                      ^
prog.cpp:7:6: note: ‘int j’ is not const
  int j = 43;
      ^
stdout
Standard output is empty