diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x/constexpr-array8.C')
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/constexpr-array8.C | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-array8.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-array8.C new file mode 100644 index 0000000000..f4aae4f58d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-array8.C @@ -0,0 +1,22 @@ +// { dg-do run { target c++11 } } + +struct A { int i,j; }; + +struct X { + A a = {1,1}; +}; + +constexpr X table[2][2] = {{ {} }}; + +#define SA(X) static_assert(X,#X) +SA(table[1][1].a.i == 1); + +extern "C" void abort(); + +const int *p = &table[1][1].a.j; + +int main() +{ + if (*p != 1) + abort(); +} |