https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112439
Bug ID: 112439 Summary: Modification of a member overlapping with a [[no_unique_address]] member in the constructor is incorrectly rejected Product: gcc Version: 13.2.1 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: de34 at live dot cn Target Milestone: --- GCC starts (incorrectly) rejecting the following code snipped since GCC13 (https://godbolt.org/z/faqMahz34). It's wrong to emit an error for this because c is not const in the constructor body. ``` struct Empty {}; class Foo { public: constexpr Foo(int x, Empty y, int z) : a(x), b(y) { c = z; } private: int a{}; [[no_unique_address]] Empty b{}; [[no_unique_address]] int c{}; }; constexpr Foo r{1, {}, 3}; ``` It seems that the code is correctly accepted if b and c are made not to overlap.