struct A { constexpr int f() { return 0; } }; void f() { const A a1; a1.f(); // Only works in C++11. For C++14 the method has to be declared f() const. }
Standard input is empty
prog.cpp: In function 'void f()': prog.cpp:9:7: error: passing 'const A' as 'this' argument discards qualifiers [-fpermissive] a1.f(); // Only works in C++11. For C++14 the method has to be declared f() const. ^ prog.cpp:3:16: note: in call to 'constexpr int A::f()' constexpr int f() { return 0; } ^
Standard output is empty