#include <iostream>using namespace std; int main() { const int PI1 = 3; constexpr int PI2 = 3; constexpr int PI3 = PI1; // works static_assert(PI1 == 3, ""); // works const double PI1__ = 3; constexpr double PI2__ = 3; constexpr double PI3__ = PI1__; // error return 0;}
Standard input is empty
prog.cpp: In function 'int main()': prog.cpp:13:30: error: the value of 'PI1__' is not usable in a constant expression constexpr double PI3__ = PI1__; // error ^ prog.cpp:11:18: note: 'PI1__' was not declared 'constexpr' const double PI1__ = 3; ^
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!