https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82461
Bug ID: 82461 Summary: Temporary required for brace-initializing (non-literal-type) member variable Product: gcc Version: 7.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: tvb377 at gmx dot de Target Milestone: --- class A { private: public: constexpr A() {} ~A() {} }; class B { private: A a; public: constexpr B() : a{} {} // works also with g++ -std=c++17: // constexpr B() : a() {} ~B() {} }; When compiling this with -std=c++17 g++ reports: error: temporary of non-literal type ‘A’ in a constant expression note: ‘A’ has a non-trivial destructor With -std=c++11 and 14 g++ accepts this code as do clang 5.0 and MS cl 19.11