fork(4) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. const double kPi = 3.14;
  6. constexpr double kPi2 = 2.0*kPi;
  7. cout << kPi2;
  8. return 0;
  9. }
  10.  
Compilation error #stdin compilation error #stdout 0s 3468KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:6:30: error: the value of 'kPi' is not usable in a constant expression
  constexpr double kPi2 = 2.0*kPi;
                              ^
prog.cpp:5:15: note: 'kPi' was not declared 'constexpr'
  const double kPi = 3.14;
               ^
stdout
Standard output is empty