[PATCH] D133574: [C2x] reject type definitions in offsetof

Alexey Neyman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 26 15:20:27 PST 2023


stilor added a comment.

In D133574#4083742 <https://reviews.llvm.org/D133574#4083742>, @aaron.ballman wrote:

> In D133574#4083724 <https://reviews.llvm.org/D133574#4083724>, @asbirlea wrote:
>
>> Following this change, the following emits warnings: https://godbolt.org/z/cvGdMWqEa, https://godbolt.org/z/GhTP85WzE
>>
>> Can you please fix fwd or revert until resolved?
>
> What do you expect to be resolved? You're passing `-Wgnu-offsetof-extensions` which is warning you about the extensions, and `-Werror` is turning them from a warning into an error, so you're getting the behavior I'd expect based on: https://reviews.llvm.org/D133574#4059845

Can you please explain how these warnings are related to the N2350? From what I see in N2350 text, it was only declaring new type definitions inside of `offsetof` to be undefined behavior. Can you please point to the language in N2350 that prohibits member access expressions like `offsetof(x, y.z)` or `offsetof(x, y[1])`?

In fact, a change <https://reviews.llvm.org/D40267> some time ago explicitly removed the warning for what it called an "non-identifier designator (e.g. `offsetof(x, a.b[c])`" in response to DR496. The language from DR496 hasn't changed in the most recent publicly available draft of the standard (which includes both DR496 and N2350), so why are these "non-identifier designators" considered extensions now?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133574/new/

https://reviews.llvm.org/D133574



More information about the cfe-commits mailing list