https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96121
Bug ID: 96121 Summary: Uninitialized variable copying not diagnosed Product: gcc Version: 11.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Consider the example: struct A { A(); }; struct B { B(A); }; struct composed2 { B b_; A a_; composed2() : b_(a_) {} }; GCC does not diagnose the uninitialized variable `a_` usage with -Wall and -Wextra. Some other compiler do diagnose: warning: field 'a_' is uninitialized when used here [-Wuninitialized] composed2() : b_(a_) {} ^ Godbolt playground: https://godbolt.org/z/AbqzjR