On Fri, Jan 15, 2021 at 1:23 AM Will Deacon <will@xxxxxxxxxx> wrote: > > Hmm. The feedback on the clang bug suggests that GCC is the one in the > wrong here (although the argument is based on C11 and I haven't trawled > through the standards to see how this has evolved): Oh well. That writing is absolutely the _worst_ kind of weaselwording standards language reading, trying to make excuses for bad behavior by basically depending on "this language is unclear", and trying to say that the buggy behavior is required by C11. What a disappointment. Absolutely nothing in the quoted C11 language says to me what that bug entry claims it says. The argument seems to hinge on "The members of an anonymous structure or union are considered to be members of the containing structure or union" and then it makes the completely uncalled-for leap that that means that because it was "int" in the const struct, it must be "int" in the containing structure too. Which is complete BS, and doesn't follow logically _or_ grammatically. It would be a "member of the containing structure" even with the "const" qualifier, so the argument they make is just inane. In fact, the _other_ sentence they quote clearly points to this being just a clang bug: "A modifiable lvalue is [...] if it is a structure or union, does not have any member (including, recursively, any member or element of all contained aggregates or unions) with a const- qualified type" and clearly this recursively is an element with a const-qualified recursive struct. Whatever. It's one of those "read the documentation squint-eyed to avoid doing the right thing" arguments. It's not worth arguing with people like that, and let's just ignore the clang bug here. Linus