gcc/testsuite/g++.dg/cpp0x/constexpr-array9.C
raw| 1 | // { dg-do run { target c++11 } } |
| 2 | |
| 3 | struct A { int i,j; }; |
| 4 | |
| 5 | struct X { |
| 6 | A a = {0,0}; |
| 7 | }; |
| 8 | |
| 9 | constexpr X table[2][2] = {{ {} }}; |
| 10 | |
| 11 | #define SA(X) static_assert(X,#X) |
| 12 | SA(table[1][1].a.i == 0); |
| 13 | |
| 14 | extern "C" void abort(); |
| 15 | |
| 16 | const int *p = &table[1][1].a.j; |
| 17 | |
| 18 | int main() |
| 19 | { |
| 20 | if (*p != 0) |
| 21 | abort(); |
| 22 | } |