https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119652
Bug ID: 119652 Summary: constinit empty direct-list-initialization incorrectly rejected Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ppalka at gcc dot gnu.org Target Milestone: --- struct __shared_count { constexpr __shared_count() {} ~__shared_count(); int _M_pi = 0; }; struct shared_ptr { __shared_count _M_refcount; }; struct A { A() = default; shared_ptr m; }; constinit A a{}; <stdin>:13:13: error: ‘constinit’ variable ‘a’ does not have a constant initializer <stdin>:13:15: error: temporary of non-literal type ‘A’ in a constant expression <stdin>:9:8: note: ‘A’ is not literal because: <stdin>:11:14: note: non-static data member ‘A::m’ has non-literal type <stdin>:6:8: note: ‘shared_ptr’ is not literal because: <stdin>:6:8: note: ‘shared_ptr’ does not have ‘constexpr’ destructor