Debian Codegraph @

gcc/testsuite/g++.dg/cpp0x/initlist-opt7.C

raw
1 // PR c++/118285
2 // { dg-do compile { target c++20 } }
3
4 #include <initializer_list>
5
6 struct A {
7 char *a;
8 union { char b[8]; long c; };
9 constexpr A (const char *x) : a(b)
10 {
11 for (int i = 0; i < 8; ++i)
12 b[i] = 0;
13 }
14 constexpr ~A ()
15 {
16 if (!foo ())
17 bar (c);
18 }
19 constexpr bool foo ()
20 {
21 char *x = a;
22 if (x == b)
23 return true;
24 return false;
25 }
26 constexpr void bar (long) {}
27 };
28
29 constexpr void
30 baz (std::initializer_list<A>)
31 {
32 }
33
34 constexpr bool
35 qux ()
36 {
37 baz ({""});
38 return true;
39 }
40
41 static_assert (qux (), "");