aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/ext/flexary2.C
blob: c0253777a1e967d47e752278b00966c028966b65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// PR c++/46688 - [4.6 Regression] g++ requires a function declaration
// when it should not
// Note that although the definition of struct B in the test case for
// c++/46688 was thought to be valid, it is, in fact, invalid, in C and
// as noted in c++/42121, should be treated as invalid in C++ as well.
// The test verifies that gcc detects and reports the right error.

// { dg-options "" }

struct A {
  A(int);
};

struct B {
  B() {}
  A a[];   // { dg-error "extension|flexible array .* in an otherwise empty" }
};

struct C {
  C() {}
  A a[0];  // -Wpedantic warning: ISO C++ forbids zero-size arrays
};