| 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[]; |
| 8 |
S () : a("bob") {} // { dg-error "initializer for flexible array member" } |
| 9 |
}; |
| 10 |
|
| 11 |
struct T { |
| 12 |
int i; |
| 13 |
char b[] = "bob"; // { dg-error "initializer for flexible array member" } |
| 14 |
T () { |
| 15 |
// the presence of this ctor definition elicits the error above |
| 16 |
// without it the flexible array initializer would be ignored |
| 17 |
// and so (unfortunately) not diagnosed |
| 18 |
} |
| 19 |
T (int) : b("bob") {} // { dg-error "initializer for flexible array member" } |
| 20 |
}; |