https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86581
Bug ID: 86581 Summary: constexpr variable is not checked Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: zhonghao at pku dot org.cn Target Milestone: --- The code is as follow: template<typename> struct V { union { int n; struct { int x,y; }; }; constexpr V() : x(0) {} }; constexpr V<int> v; g++ does not check whether v is initialized. Instead, clang++ does that: code0.cpp:6:18: error: constexpr variable 'v' must be initialized by a constant expression constexpr V<int> v; ^ code0.cpp:6:18: note: subobject of type 'int' is not initialized 1 error generated.