fork download
  1. int main() {
  2. static int x;
  3. int y;
  4. constexpr int* px = &x; // Compilation is successful
  5. constexpr int* py = &y; // Compilation will fail
  6. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:5:25: error: ‘& y’ is not a constant expression
     constexpr int* py = &y; // Compilation will fail
                         ^~
stdout
Standard output is empty