111
|
1 // PR c++/68478 - flexible array members have complete type
|
|
2 // { dg-do compile }
|
|
3 // { dg-options "-Wno-error=pedantic" }
|
|
4
|
|
5 // Test to verify that attempting to use a flexible array member where
|
|
6 // a complete type is required is rejected.
|
|
7
|
|
8 struct A {
|
|
9 int n;
|
|
10 int a[];
|
|
11 enum {
|
|
12 e = sizeof a // { dg-error "invalid application of .sizeof. to incomplete type" }
|
|
13 };
|
|
14 };
|
|
15
|
|
16 struct B {
|
|
17 int n;
|
|
18 typedef int A[];
|
|
19 A a;
|
|
20 enum {
|
|
21 e = sizeof a // { dg-error "invalid application of .sizeof. to incomplete type" }
|
|
22 };
|
|
23 };
|