| 1 |
// PR c++/72775 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
// { dg-options -Wno-pedantic } |
| 4 |
|
| 5 |
struct S { |
| 6 |
int i; |
| 7 |
char a[] = "foo"; // { dg-error "initializer for flexible array member" } |
| 8 |
S () {} |
| 9 |
}; |
| 10 |
|
| 11 |
struct T { |
| 12 |
int i; |
| 13 |
char a[] = "foo"; // { dg-error "initializer for flexible array member" } |
| 14 |
}; |
| 15 |
|
| 16 |
struct U { |
| 17 |
int i; |
| 18 |
char a[] = "foo"; // { dg-error "initializer for flexible array member" } |
| 19 |
U (); |
| 20 |
}; |
| 21 |
|
| 22 |
U::U() {} |
| 23 |
|
| 24 |
int |
| 25 |
main () |
| 26 |
{ |
| 27 |
struct T t; |
| 28 |
} |
| 29 |
|
| 30 |
struct V { |
| 31 |
int i; |
| 32 |
struct W { |
| 33 |
int j; |
| 34 |
char a[] = "foo"; // { dg-error "initializer for flexible array member" } |
| 35 |
} w; |
| 36 |
V () {} |
| 37 |
}; |
| 38 |
|
| 39 |
template <class T> |
| 40 |
struct X { |
| 41 |
int i; |
| 42 |
T a[] = "foo"; // { dg-error "initializer for flexible array member" } |
| 43 |
}; |
| 44 |
|
| 45 |
void |
| 46 |
fn () |
| 47 |
{ |
| 48 |
struct X<char> x; |
| 49 |
} |