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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 13 11:20:57 PST 2023


aaron.ballman added a comment.

In D133574#4052293 <https://reviews.llvm.org/D133574#4052293>, @efriedma wrote:

> Given the extension appears to have real-world usage, I don't see any reason to break that usage.  All known implementations parse this the way the user expects, there isn't any chance the user meant to write something else, and there isn't any chance it will mean something else in a future version of the standard.

I've reached out privately to some folks in GCC to find out whether they plan to define this behavior in their builtin or not. One response I've gotten so far is that they expect a type to be allowed to be defined in C but not in C++ (so `offsetof` has the usual expected behavior in each language). Because of the existing code and because of GCC, I'm leaning pretty strongly towards defining the behavior for C and issuing an extension warning. If anyone has a strong opinion to the contrary, please speak up!


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