We were accepting invalid code where the qualifiers of the anonymous structure were not taken into account when forming a member access to one of the indirect fields, as in:
struct S { const struct { int i; }; } s; void foo(void) { s.i = 12; // previously accepted, now rejected }
We now expose the anonymous structure's field as having a qualified type instead of an unqualified type so that access checking notes that an intermediate object in the expression is qualified. We also adjusted the diagnostic so that it's slightly more user friendly despite this being a rather rare case.
Note, this only impacts C; in C++ and with the Microsoft C anonymous structure extension, the qualifiers are stripped.
Fixes #48099
Perhaps the first sentence should clarify that it applies only to C modes? Though the code changes don't appear to be specific to C.
I'm confused by "Note that qualifiers are ignored in C++ and for Microsoft's extension of anonymous objects". I find it very surprising that cv-qualifiers would be ignored in C++. Unless there is a relevant core issue?