OSDN Git Service

2012-06-14 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / ext / attrib32.C
1 // PR c++/35315
2
3 typedef union { int i; } U __attribute__((transparent_union));
4
5 static void foo(U) {}
6 static void foo(int) {}
7
8 void bar()
9 {
10   foo(0);
11 }
12
13 typedef union U1 { int i; } U2 __attribute__((transparent_union)); // { dg-warning "ignored" }
14
15 static void foo2(U1) {}         // { dg-error "previously defined" }
16 static void foo2(U2) {}         // { dg-error "redefinition" }
17
18 void bar2(U1 u1, U2 u2)
19 {
20   foo2(u1);
21   foo2(u2);
22 }
23
24 // PR c++/36410
25 struct A
26 {
27   typedef union
28   {
29     int i;
30   } B __attribute__((transparent_union));
31 };
32
33 void foo(A::B b)
34 {
35   b.i;
36 }