| 1 |
// PR c++/83588 - struct with two flexible arrays causes an internal compiler |
| 2 |
// error |
| 3 |
// { dg-do compile } |
| 4 |
// { dg-options "-Wno-pedantic" } |
| 5 |
|
| 6 |
struct A { |
| 7 |
int i; |
| 8 |
int a[]; // { dg-error "flexible array member .A::a. not at end of .struct A." } |
| 9 |
int b[]; |
| 10 |
}; |
| 11 |
|
| 12 |
struct B { |
| 13 |
int i; |
| 14 |
int a[]; // { dg-error "flexible array member .B::a. not at end of .struct B." } |
| 15 |
int j; |
| 16 |
int b[][2]; |
| 17 |
}; |
| 18 |
|
| 19 |
struct C { |
| 20 |
int i; |
| 21 |
struct { |
| 22 |
int a[]; // { dg-error "flexible array member .C::<unnamed struct>::a. not at end of .struct C." } |
| 23 |
}; |
| 24 |
int b[]; |
| 25 |
}; |
| 26 |
|
| 27 |
struct D { |
| 28 |
int i; |
| 29 |
struct { |
| 30 |
int a[]; // { dg-error "flexible array member .D::<unnamed struct>::a. not at end of .struct D." } |
| 31 |
} b[]; |
| 32 |
int c[]; |
| 33 |
}; |
| 34 |
|
| 35 |
struct E { |
| 36 |
int i; |
| 37 |
int a[0]; |
| 38 |
int b[]; // { dg-error "flexible array member .E::b. not at end of .struct E." } |
| 39 |
int d[]; |
| 40 |
}; |
| 41 |
|
| 42 |
struct F { |
| 43 |
int i; |
| 44 |
int a[]; // { dg-error "flexible array member .F::a. not at end of .struct F." } |
| 45 |
int b[], c[], d[]; |
| 46 |
}; |