111
|
1 // PR c++/35315
|
|
2 // { dg-do compile { target c++11 } }
|
|
3
|
|
4 typedef union { int i; } U [[gnu::transparent_union]]; // { dg-warning "ignored" }
|
|
5
|
|
6 static void foo(U) {}
|
|
7 static void foo(int) {}
|
|
8
|
|
9 void bar()
|
|
10 {
|
|
11 foo(0);
|
|
12 }
|
|
13
|
|
14 typedef union U1 { int i; } U2 [[gnu::transparent_union]]; // { dg-warning "ignored" }
|
|
15
|
|
16 static void foo2(U1) {} // { dg-message "previously defined" }
|
|
17 static void foo2(U2) {} // { dg-error "redefinition" }
|
|
18
|
|
19 void bar2(U1 u1, U2 u2)
|
|
20 {
|
|
21 foo2(u1);
|
|
22 foo2(u2);
|
|
23 }
|
|
24
|
|
25 // PR c++/36410
|
|
26 struct A
|
|
27 {
|
|
28 typedef union [[gnu::transparent_union]]
|
|
29 {
|
|
30 int i;
|
|
31 } B;
|
|
32 };
|
|
33
|
|
34 void foo(A::B b)
|
|
35 {
|
|
36 b.i;
|
|
37 }
|