| 1 |
// PR c++/91353 - P1331R2: Allow trivial default init in constexpr contexts. |
| 2 |
// { dg-do compile { target c++20 } } |
| 3 |
|
| 4 |
struct E { }; |
| 5 |
|
| 6 |
struct S { |
| 7 |
E e; |
| 8 |
constexpr S() {} |
| 9 |
}; |
| 10 |
|
| 11 |
constexpr S s; |
| 12 |
constexpr S s2[4]; |
| 13 |
|
| 14 |
struct W { |
| 15 |
[[no_unique_address]] E e1, e2; |
| 16 |
constexpr W() {} |
| 17 |
}; |
| 18 |
|
| 19 |
constexpr W w; |
| 20 |
constexpr W w2[4]; |
| 21 |
|
| 22 |
struct Y { |
| 23 |
[[no_unique_address]] E e; |
| 24 |
__extension__ char a[0]; |
| 25 |
constexpr Y() {} |
| 26 |
}; |
| 27 |
|
| 28 |
constexpr Y y; |
| 29 |
constexpr Y y2[4]; |
| 30 |
|
| 31 |
struct Z { |
| 32 |
[[no_unique_address]] E e; |
| 33 |
int i; |
| 34 |
constexpr Z(int n) :i(n) { } |
| 35 |
}; |
| 36 |
|
| 37 |
constexpr Z z(42); |