https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101818
Bug ID: 101818 Summary: Error message for the wrong name in designated initializers could be improved Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: hewillk at gmail dot com Target Milestone: --- Consider: https://godbolt.org/z/8xrocoTcG struct Op { int a, b; }; Op op{.a = 0, .x = 0, .b = 0}; Clang rejects with: <source>:3:8: error: field designator 'x' does not refer to any field in type 'Op' .x = 0, ^ However, GCC rejects with: <source>:6:13: error: 'Op' has no non-static data member named 'x' 6 | .b = 0}; | ^ It would be less confusing and more user-friendly if the cursor can actually point to the x.