Debian Codegraph @

gcc/testsuite/g++.dg/ext/builtin-offsetof3.C

raw
1 // PR c++/85061
2 // { dg-do compile }
3
4 struct B { int a, b; };
5 struct A
6 {
7 static int x[2];
8 static int y;
9 static B z;
10 };
11
12 int i = __builtin_offsetof (volatile A, x[0]); // { dg-error "cannot apply 'offsetof' to static data member 'A::x'" }
13 int j = __builtin_offsetof (volatile A, y); // { dg-error "cannot apply 'offsetof' to static data member 'A::y'" }
14 int k = __builtin_offsetof (volatile A, z.a); // { dg-error "cannot apply 'offsetof' to a non constant address" }