* decl.c (make_typename_type): s/parameters/arguments/.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / union3.C
blobd95d30c6fe3ec23fd5b97c7f703287310e1275d1
1 // Runtime test for C++11 unrestricted unions
2 // { dg-do run { target c++11 } }
4 int c, d;
5 struct A
7   int i;
8   A(): i(1) { ++c; }
9   A(const A&): i(2) { ++c; }
10   ~A() { ++d; }
13 union B
15   A a;
16   B() { }
17   B(const B& b) { }
18   ~B() { }
21 struct C
23   union { A a; };
24   C() { }
25   C(const C&) { }
26   ~C() { }
29 union D
31   A a;
32   D(): a() { }
33   D(const D& d): a(d.a) { }
34   ~D() { a.~A(); }
37 struct E
39   union { A a; };
40   E(): a() { }
41   E(const E& e): a (e.a) { }
42   ~E() { a.~A(); }
45 int main()
47   {
48     B b1;
49     B b2(b1);
51     C c1;
52     C c2(c1);
53   }
55   if (c != 0 || d != 0)
56     return c+d*10;
58   {
59     D d1;
60     D d2(d1);
62     E e1;
63     E e2(e1);
64   }
66   if (c != 4 || d != 4)
67     return c*100+d*1000;