https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90475
Bug ID: 90475 Summary: Diagnostic for designated initializer could be a lot better Product: gcc Version: 9.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- gcc 8 and 9 have made dramatic improvements in diagnostics, but here's a case where it could be a lot better: the "oops, I typoed my designated initializer" case: struct X { int i, j; }; X f() { return {.i=42, .k=17}; } emits: <source>: In function 'X f()': <source>:3:29: error: could not convert '{42, 17}' from '<brace-enclosed initializer list>' to 'X' 3 | X f() { return {.i=42, .k=17}; } | ^ | | | <brace-enclosed initializer list> Compiler returned: 1 Similarly: struct X { int i, j; }; void g(X ); void h() { g({.i=42, .k=17}); } emits: <source>: In function 'void h()': <source>:5:21: error: could not convert '{42, 17}' from '<brace-enclosed initializer list>' to 'X' 5 | g({.i=42, .k=17}); | ^ | | | <brace-enclosed initializer list> Compiler returned: 1 Would be very cool if the diagnostic could somehow point to the "k" initializer, rather than basically "I dunno what is this thing??" (obviously not the most high priority thing, just a nice to have)