https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66297
Bug ID: 66297 Summary: constexpr non-static member functions of non-literal types Product: gcc Version: 5.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: lloda at bluewin dot ch Target Milestone: --- See https://groups.google.com/a/isocpp.org/forum/#!topic/std-discussion/6jM8M8FUs30 and referenced there http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1684. The example given in the first link #include <string> struct X { std::string s; constexpr int foo() { return 42; } }; int main() {} clang 3.6 accepts the code. GCC 5.1.0 produces this error: > $CXX -std=c++14 constexpr-nonliteral.C constexpr-nonliteral.C:7:19: error: enclosing class of constexpr non-static member function 'int X::foo()' is not a literal type constexpr int foo() { return 42; } ^ constexpr-nonliteral.C:5:8: note: 'X' is not literal because: struct X { ^ constexpr-nonliteral.C:5:8: note: 'X' has a non-trivial destructor