OSDN Git Service

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