OSDN Git Service

* g++.old-deja/g++.other/eh4.C: Fix typo.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.old-deja / g++.other / union2.C
1 // Bug: g++ crashed on empty intializers for unions.
2 // Bug: gcc and g++ didn't zero unions with empty initializers.
3 // Submitted by J"orn Rennecke <amylaar@cygnus.co.uk>
4
5 extern "C" void exit (int);
6
7 typedef union u
8 {
9   union u *up;
10   void *vp;
11 } u;
12
13 static u v = {};
14
15 void bar (u);
16 void baz (u);
17
18 void foo()
19 {
20        u w = {};
21        u x = { &v };
22        baz (x);
23        bar (w);
24 }
25
26 void baz (u w) { }
27
28 void bar (u w)
29 {
30   if (w.up)
31     exit (1);
32 }
33
34 int main ()
35 {
36   foo ();
37   return 0;
38 }