aaron.ballman added inline comments.
================ Comment at: clang/docs/ReleaseNotes.rst:59 -------------------- +- Improved ``__builtin_offsetof`` support, allowing qualified name in member designator. This fixes [Issue 64154](https://github.com/llvm/llvm-project/issues/64154). ---------------- ================ Comment at: clang/lib/Parse/ParseExpr.cpp:2646-2651 + if (Tok.is(tok::coloncolon) && getLangOpts().CPlusPlus) { + Comps.back().Kind = Sema::OffsetOfComponent::Qualifier; + } else if (Tok.is(tok::coloncolon) && !getLangOpts().CPlusPlus) { + Res = ExprError(); + break; + } ---------------- I think this is slightly more clear. ================ Comment at: clang/test/SemaCXX/offsetof.cpp:106 +int x3[__builtin_offsetof(struct X2, X2::static_a) == 0 ? 1 : -1]; // expected-error{{no member named 'static_a'}} +int x4[__builtin_offsetof(struct X2, X2::X2) == 0 ? 1 : -1]; // expected-error{{no member named 'X2'}} + ---------------- There's one more test I'd like to see: ``` struct S { int Foo; }; template <typename Ty> void func() { static_assert(__builtin_offsetof(Ty, Ty::Foo) == 0, ""); } void inst() { func<S>(); } ``` Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D157201/new/ https://reviews.llvm.org/D157201 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits