[PATCH] D142723: [C2x] Stop diagnosing member and array access in offsetof as an extension

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 30 11:57:10 PST 2023


aaron.ballman added inline comments.


================
Comment at: clang/docs/LanguageExtensions.rst:2389
   const int ext1 = __builtin_offsetof(struct U { int i; }, i); // C extension
-  const int ext2 = __builtin_offsetof(struct S, t.f[1]); // C & C++ extension
+  const int ext2 = __builtin_offsetof(struct S, t.f[1]);
 
----------------
stilor wrote:
> Minor nit: maybe rename from `ext2` to, say, `offset_to_subobject` to avoid implying it is an extension.
I've made that change on trunk, but I probably won't cherry-pick it over to 16 as the example is reasonably clear enough. That said, if you feel strongly, feel free to pick it: 9367bd05913b11aaadf89c4edeced4321c65b605


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142723



More information about the cfe-commits mailing list