https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111261
Bug ID: 111261 Summary: No warning for out of order class initialisation when using class initialisers Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: matt at godbolt dot org Target Milestone: --- The code: ``` struct S { std::size_t len{s.size()}; std::string s{"A rather long string"}; }; ``` warns on clang, but not on GCC. https://compiler-explorer.com/z/5qf3WbdY7 The equivalent code using a constructor _does_ warn on both compilers: ``` struct S { std::size_t len; std::string s; S() : s{"A rather long string"}, len{s.size()} {} }; ``` ( https://compiler-explorer.com/z/Wov4Tx93v )