[PATCH] D157201: [Clang] Support qualified name as member designator in offsetof
Yichi Lee via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 7 04:23:28 PDT 2023
yichi170 added inline comments.
================
Comment at: clang/test/Sema/offsetof.c:79
+int x2[__builtin_offsetof(struct X2, X2::a) == 0 ? 1 : -1];
+int x3[__builtin_offsetof(struct X2, X2::X2) == 0 ? 1 : -1]; // expected-error{{no member named 'X2'}}
+
----------------
Fznamznon wrote:
> It probably makes sense to also add a test with static member of a class, like Aaron mentioned in GitHub - https://github.com/llvm/llvm-project/issues/64154#issuecomment-1653468938 .
Hi @Fznamznon, I found that clang and clang++ output different errors with the following test.
```
struct X2 { int a; static int static_a; };
int x4[__builtin_offsetof(struct X2, X2::static_a) == 0 ? 1 : -1];
// expected-error{{no member named 'static_a'}}
```
C doesn't allow to have a static member in the struct, so is there any way to write the correct comment to make the test pass?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157201/new/
https://reviews.llvm.org/D157201
More information about the cfe-commits
mailing list