| 1 |
// PR c++/90938 - Initializing array with {1} works, but not {0} |
| 2 |
// { dg-do compile { target c++20 } } |
| 3 |
// { dg-options "-Wall" } |
| 4 |
|
| 5 |
struct A { int i; }; |
| 6 |
struct B { A a[2]; }; |
| 7 |
|
| 8 |
static const constexpr A a0 = { 0 }; |
| 9 |
static const constexpr A a_ = { }; |
| 10 |
|
| 11 |
template <B> struct X { }; |
| 12 |
|
| 13 |
typedef X<B{ }> XB; |
| 14 |
typedef X<B{{A{ }}}> XB; |
| 15 |
typedef X<B{{A{ 0 }}}> XB; |
| 16 |
typedef X<B{{a_}}> XB; |
| 17 |
typedef X<B{{a0}}> XB; |
| 18 |
typedef X<B{{a_, A{ }}}> XB; |
| 19 |
typedef X<B{{a_, A{ 0 }}}> XB; |
| 20 |
typedef X<B{{a_, a_}}> XB; |
| 21 |
typedef X<B{{a_, a0}}> XB; |
| 22 |
|
| 23 |
|
| 24 |
struct C { constexpr C () = default; }; |
| 25 |
struct D { C c[2]; }; |
| 26 |
|
| 27 |
static const constexpr C c_ = { }; |
| 28 |
|
| 29 |
template <D> struct Y { }; |
| 30 |
|
| 31 |
typedef Y<D{ }> YD; |
| 32 |
typedef Y<D{C { }}> YD; |
| 33 |
typedef Y<D{{c_}}> YD; |
| 34 |
typedef Y<D{C{ }, C{ }}> YD; |
| 35 |
typedef Y<D{C{ }, c_}> YD; |
| 36 |
typedef Y<D{{c_, c_}}> YD; |