aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/array-2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/array-2.c')
-rw-r--r--gcc-4.9/gcc/testsuite/gcc.dg/array-2.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/array-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/array-2.c
new file mode 100644
index 000000000..497c58666
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/gcc.dg/array-2.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+/* Verify that we can't do things to get ourselves in trouble
+ with GCC's initialized flexible array member extension. */
+
+struct f { int w; int x[]; };
+struct g { struct f f; };
+struct g g1 = { { 0, { } } };
+struct g g2 = { { 0, { 1 } } }; /* { dg-error "nested context" "nested" } */
+ /* { dg-error "near init" "near" { target *-*-* } 10 } */
+struct h { int x[0]; int y; };
+struct h h1 = { { 0 }, 1 }; /* { dg-warning "excess elements" "excess" } */
+ /* { dg-warning "near init" "before end" { target *-*-* } 13 } */