| 1 |
// PR c++/92812 |
| 2 |
// P1975R0 |
| 3 |
// { dg-do run { target c++20 } } |
| 4 |
// { dg-options "-Wall -Wextra" } |
| 5 |
|
| 6 |
struct Aggr { int x; int y; }; |
| 7 |
struct Base { int i; Base(int i_) : i{i_} { } }; |
| 8 |
struct BaseAggr : Base { }; |
| 9 |
struct X { }; |
| 10 |
struct AggrSDM { static X x; int i; int j; }; |
| 11 |
|
| 12 |
int |
| 13 |
main () |
| 14 |
{ |
| 15 |
Aggr a = static_cast<Aggr>(42); // { dg-warning "missing initializer" } |
| 16 |
if (a.x != 42 || a.y != 0) |
| 17 |
__builtin_abort (); |
| 18 |
BaseAggr b = static_cast<BaseAggr>(42); |
| 19 |
if (b.i != 42) |
| 20 |
__builtin_abort (); |
| 21 |
AggrSDM s = static_cast<AggrSDM>(42); // { dg-warning "missing initializer" } |
| 22 |
if (s.i != 42 || s.j != 0) |
| 23 |
__builtin_abort (); |
| 24 |
} |