gcc/testsuite/g++.dg/ext/flexary10.C
raw| 1 | // PR c++/68490 - error initializing a structure with a flexible array member |
| 2 | // { dg-do compile } |
| 3 | // { dg-options "-Wpedantic" } |
| 4 | |
| 5 | struct A { |
| 6 | int n; |
| 7 | int a[]; // { dg-warning "7:ISO C\\+\\+ forbids flexible array member" } |
| 8 | }; |
| 9 | |
| 10 | struct A foo (void) |
| 11 | { |
| 12 | // Verify the initializer below is accepted for compatibility with gcc |
| 13 | // (in C mode). |
| 14 | static struct A |
| 15 | a = { 2, { 1, 0 } }; // { dg-warning "initialization of a flexible array member" } |
| 16 | |
| 17 | return a; |
| 18 | } |