gcc/testsuite/g++.dg/cpp0x/constexpr-union4.C
raw| 1 | // PR c++/54922 |
| 2 | // { dg-do compile { target c++11 } } |
| 3 | |
| 4 | struct nullable_int |
| 5 | { |
| 6 | bool init_; |
| 7 | union { |
| 8 | unsigned char for_value_init; |
| 9 | int value_; |
| 10 | }; |
| 11 | |
| 12 | constexpr nullable_int() : init_(false), for_value_init() {} |
| 13 | }; |
| 14 | |
| 15 | #define SA(X) static_assert(X,#X) |
| 16 | |
| 17 | constexpr nullable_int n; |
| 18 | SA((n.for_value_init == 0)); |