https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112839
Bug ID: 112839 Summary: Unable to default initialize member variable in specific circumstances Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: luigighiron at gmail dot com Target Milestone: --- The following code is not accepted by GCC: struct A { struct B { int C = 0; }; A() = default; A(int) {} std::pair<B, B> p; }; The error message generated indicates that it was unable to find a constructor to call in the constructor A(int). Doing any of the following seems to remove the error: 1. Removing the constructor A() 2. Explicitly define the constructor A() 3. Defining a default constructor for B (that isn't defaulted) 4. Removing the default value from C 5. Initializing p when it is being declared, i.e. std::pair<B, B> p{}; 6. Defining B outside of the class 7. Using a non-default constructor in the member initializer list Clang, MSVC, and old versions of GCC (version 8, version 5, and version 4) accept this code.