https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111090
Bug ID: 111090 Summary: Bogus -Wuninitialized for trivial copy of nested struct with partially initialized array Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ed at catmur dot uk Target Milestone: --- struct A { A() { buf[0] = 0; } int buf[2]; }; struct B { A a; }; struct C { C(B const& b) : b(b) {} B b; }; struct D { D(C c) : c(c) {} C c; }; D f() { return D(C(B())); } In constructor 'C::C(const B&)', inlined from 'D f()' at <source>:14:16: <source>:7:21: warning: '<unnamed>.B::a.A::a[1]' is used uninitialized [-Wuninitialized] 7 | C(B const& b) : b(b) {} | ^~~~ <source>: In function 'D f()': <source>:14:22: note: '<anonymous>' declared here 14 | D f() { return D(C(B())); } | ^ This appears to have started in 7.1.