gcc/testsuite/g++.dg/cpp1y/vla-initlist1.C
raw| 1 | // { dg-do run { target c++11 } } |
| 2 | // { dg-skip-if "power overwrites two slots of array i" { "power*-*-*" } } |
| 3 | // { dg-options "-Wno-vla" } |
| 4 | |
| 5 | #include <initializer_list> |
| 6 | |
| 7 | struct A |
| 8 | { |
| 9 | int i; |
| 10 | A(std::initializer_list<int>) { } |
| 11 | A(int i): i{i} { } |
| 12 | ~A() {} |
| 13 | }; |
| 14 | |
| 15 | int x = 4; |
| 16 | int main(int argc, char **argv) |
| 17 | { |
| 18 | { int i[x] = { 42, 42, 42, 42 }; } |
| 19 | { |
| 20 | A a[x] = { argc }; |
| 21 | if (a[1].i != 42) |
| 22 | __builtin_abort (); |
| 23 | } |
| 24 | } |