int main() { static int x; int y; constexpr int* px = &x; // Compilation is successful constexpr int* py = &y; // Compilation will fail }
Standard input is empty
prog.cpp: In function ‘int main()’: prog.cpp:5:25: error: ‘& y’ is not a constant expression constexpr int* py = &y; // Compilation will fail ^~
Standard output is empty