Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/constexpr-init14.C

raw
1 // PR c++/91353 - P1331R2: Allow trivial default init in constexpr contexts.
2 // { dg-do compile { target c++20 } }
3
4 struct E {
5 constexpr E() = default;
6 constexpr E(int) {}
7 };
8
9 struct W {
10 [[no_unique_address]] E e;
11 constexpr W(int) : e(8) {}
12 };
13
14 constexpr W w = W(42);
15
16 struct S {
17 E e;
18 constexpr S() : e{} { }
19 };
20
21 constexpr S s;
22
23 struct S2 {
24 [[no_unique_address]] E e;
25 constexpr S2() : e{} { }
26 };
27
28 constexpr S2 s2;