aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/ext/flexary20.C
blob: 10a06b499480c517d33e9f90f321bcb37c6beaee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// PR c++/72775
// { dg-do compile { target c++11 } }
// { dg-options -Wno-pedantic }

struct S {
  int i;
  char a[] = "foo";   // { dg-error "initializer for flexible array member" }
  S () {}
};

struct T {
  int i;
  char a[] = "foo";   // { dg-error "initializer for flexible array member" }
};

struct U {
  int i;
  char a[] = "foo";   // { dg-error "initializer for flexible array member" }
  U ();
};

U::U() {}

int
main ()
{
  struct T t;
}

struct V {
  int i;
  struct W {
    int j;
    char a[] = "foo";   // { dg-error "initializer for flexible array member" }
  } w;
  V () {}
};

template <class T>
struct X {
  int i;
  T a[] = "foo";   // { dg-error "initializer for flexible array member" }
};

void
fn ()
{
  struct X<char> x;
}