| 1 |
// PR c++/46688 - [4.6 Regression] g++ requires a function declaration |
| 2 |
// when it should not |
| 3 |
// Note that although the definition of struct B in the test case for |
| 4 |
// c++/46688 was thought to be valid, it is, in fact, invalid, in C and |
| 5 |
// as noted in c++/42121, should be treated as invalid in C++ as well. |
| 6 |
// The test verifies that gcc detects and reports the right error. |
| 7 |
|
| 8 |
// { dg-options "" } |
| 9 |
|
| 10 |
struct A { |
| 11 |
A(int); |
| 12 |
}; |
| 13 |
|
| 14 |
struct B { |
| 15 |
B() {} |
| 16 |
A a[]; |
| 17 |
}; |
| 18 |
|
| 19 |
struct C { |
| 20 |
C() {} |
| 21 |
A a[0]; // -Wpedantic warning: ISO C++ forbids zero-size arrays |
| 22 |
}; |
| 23 |
|