annotate gcc/testsuite/g++.dg/ext/offsetof1.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 // PR c++/27601
kono
parents:
diff changeset
2 // Origin: Patrik Hägglund <patrik.hagglund@bredband.net>
kono
parents:
diff changeset
3 // { dg-do compile }
kono
parents:
diff changeset
4 // { dg-options "-Wno-pointer-arith" }
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 struct bar {
kono
parents:
diff changeset
7 static int foo;
kono
parents:
diff changeset
8 static int baz();
kono
parents:
diff changeset
9 };
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 int a = __builtin_offsetof(bar, foo); // { dg-error "static data member" }
kono
parents:
diff changeset
12 int av = __builtin_offsetof(volatile bar, foo); // { dg-error "static data member" }
kono
parents:
diff changeset
13 int b = __builtin_offsetof(bar, baz); // { dg-error "member function" }
kono
parents:
diff changeset
14 int b0 = __builtin_offsetof(bar, baz[0]); // { dg-error "single identifier nor|member function" }
kono
parents:
diff changeset
15 int bv0 = __builtin_offsetof(volatile bar, baz[0]); // { dg-error "function" }
kono
parents:
diff changeset
16 int c = __builtin_offsetof(bar, ~bar); // { dg-error "member function" }
kono
parents:
diff changeset
17
kono
parents:
diff changeset
18 typedef int I;
kono
parents:
diff changeset
19 enum E { };
kono
parents:
diff changeset
20
kono
parents:
diff changeset
21 int d = __builtin_offsetof(I, ~I); // { dg-error "destructor" }
kono
parents:
diff changeset
22 int e = __builtin_offsetof(E, ~E); // { dg-error "destructor" }