aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/ext/flexary6.C
blob: 92677cd2aab4afb6ca06b563c789a3065731cdf0 (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++/68478 - flexible array members have complete type
// { dg-do compile }
// { dg-options "-Wno-error=pedantic" }

// Test to verify that attempting to use a flexible array member where
// a complete type is required is rejected.

struct A {
  int n;
  int a[];
  enum {
    e = sizeof a   // { dg-error "invalid application of .sizeof. to incomplete type" }
  };
};

struct B {
  int n;
  typedef int A[];
  A a;
  enum {
    e = sizeof a   // { dg-error "invalid application of .sizeof. to incomplete type" }
  };
};