https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95085
Bug ID: 95085 Summary: diagnostic on designated-initializer from braced-init-list could be better Product: gcc Version: 10.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: --- In this program (note the typo in the call to f): struct A { int width, height; }; void f(A); void g() { f(A{.width=1, .hieght=2}); } gcc's diagnostic is absolutely excellent: <source>:7:20: error: field designator 'hieght' does not refer to any field in type 'A'; did you mean 'height'? f(A{.width=1, .hieght=2}); ^~~~~~ height <source>:2:16: note: 'height' declared here int width, height; ^ However, if instead of calling f(A{...}) we instead just call f({...}) (as is common to do if the type name is meaningless and is just used as a proxy for named function arguments): struct A { int width, height; }; void f(A); void g() { f({.width=1, .hieght=2}); } then we get a much worse diagnostic: <source>:7:5: error: no matching function for call to 'f' f({.width=1, .hieght=2}); ^ <source>:5:6: note: candidate function not viable: cannot convert initializer list argument to 'A' void f(A); ^ Basically just: "error". Would it be possible to get the same quality of diagnostic from the named call case as it is in the just-a-braced-init-list case?