annotate gcc/testsuite/gcc.dg/array-14.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* { dg-do compile } */
kono
parents:
diff changeset
2 /* { dg-options "" } */
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 /* Verify that GCC forbids non-static initialization of
kono
parents:
diff changeset
5 flexible array members. */
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 typedef char T[];
kono
parents:
diff changeset
8 struct str { int len; T s; };
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 struct str a = { 2, "a" };
kono
parents:
diff changeset
11
kono
parents:
diff changeset
12 void foo()
kono
parents:
diff changeset
13 {
kono
parents:
diff changeset
14 static struct str b = { 2, "b" };
kono
parents:
diff changeset
15 struct str c = { 2, "c" }; /* { dg-error "(non-static)|(near initialization)" } */
kono
parents:
diff changeset
16 struct str d = (struct str) { 2, "d" }; /* { dg-error "(non-static)|(near initialization)" } */
kono
parents:
diff changeset
17 struct str e = (struct str) { d.len, "e" }; /* { dg-error "(non-static)|(initialization)" } */
kono
parents:
diff changeset
18 }