111
|
1 // PR c++/27601
|
|
2 // Origin: Patrik Hägglund <patrik.hagglund@bredband.net>
|
|
3 // { dg-do compile }
|
|
4 // { dg-options "-Wno-pointer-arith" }
|
|
5
|
|
6 struct bar {
|
|
7 static int foo;
|
|
8 static int baz();
|
|
9 };
|
|
10
|
|
11 int a = __builtin_offsetof(bar, foo); // { dg-error "static data member" }
|
|
12 int av = __builtin_offsetof(volatile bar, foo); // { dg-error "static data member" }
|
|
13 int b = __builtin_offsetof(bar, baz); // { dg-error "member function" }
|
|
14 int b0 = __builtin_offsetof(bar, baz[0]); // { dg-error "single identifier nor|member function" }
|
|
15 int bv0 = __builtin_offsetof(volatile bar, baz[0]); // { dg-error "function" }
|
|
16 int c = __builtin_offsetof(bar, ~bar); // { dg-error "member function" }
|
|
17
|
|
18 typedef int I;
|
|
19 enum E { };
|
|
20
|
|
21 int d = __builtin_offsetof(I, ~I); // { dg-error "destructor" }
|
|
22 int e = __builtin_offsetof(E, ~E); // { dg-error "destructor" }
|