Debian Codegraph @

gcc/testsuite/g++.dg/cpp0x/initlist122.C

raw
1 // PR c++/94041
2 // { dg-do run { target c++11 } }
3
4 bool gone;
5 struct Temp { ~Temp() { gone = true; } };
6 struct A{ A() {}; A(const Temp&) noexcept {}; };
7 struct B{ ~B() {}; };
8 struct Pair{ A a; B b; };
9 void foo(const Pair&) noexcept { if (gone) __builtin_abort(); }
10
11 B bar() { if (gone) __builtin_abort(); return {}; }
12
13 int main()
14 {
15 Pair p{A(Temp{}), bar()};
16
17 if (!gone) __builtin_abort ();
18
19 gone = false;
20
21 foo({A(Temp{})});
22
23 if (!gone) __builtin_abort ();
24 }