Debian Codegraph @

gcc/testsuite/g++.dg/cpp0x/anon-union1.C

raw
1 // PR c++/66583
2 // { dg-do run { target c++11 } }
3
4 template <class T>
5 T&& move(T& t) { return static_cast<T&&>(t); }
6
7 struct A {
8 A() { };
9 A(const A&) { }
10 };
11
12 struct B {
13 union {
14 int m_1 = 0;
15 int m_2;
16 };
17 A dummy;
18 };
19
20 int main()
21 {
22 B b;
23 b.m_1 = 1;
24 B c = move(b);
25 if (c.m_1 != 1)
26 __builtin_abort();
27 }