PR r++/68490 - error initializing a structure with a flexible array membe
authorMartin Sebor <msebor@redhat.com>
Sat, 30 Jan 2016 17:30:32 +0000 (17:30 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Sat, 30 Jan 2016 17:30:32 +0000 (10:30 -0700)
gcc/testsuite/ChangeLog:
2016-01-30  Martin Sebor  <msebor@redhat.com>

        PR c++/68490
        * g++.dg/ext/flexary10.C: New test.

From-SVN: r233010

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/flexary10.C [new file with mode: 0644]

index fc4232d80ee611916bada0fc543d6ff3720a45e3..3bea4af000f1c48a2f9b796f2a10c29598cdfbd2 100644 (file)
@@ -1,3 +1,8 @@
+2016-01-30  Martin Sebor  <msebor@redhat.com>
+
+       PR c++/68490
+       * g++.dg/ext/flexary10.C: New test.
+
 2016-01-30  Dominique d'Humieres  <dominiq@lps.ens.fr>
 
        PR fortran/66707
diff --git a/gcc/testsuite/g++.dg/ext/flexary10.C b/gcc/testsuite/g++.dg/ext/flexary10.C
new file mode 100644 (file)
index 0000000..f2868f3
--- /dev/null
@@ -0,0 +1,18 @@
+// PR c++/68490 - error initializing a structure with a flexible array member
+// { dg-do compile }
+// { dg-options "-Wpedantic" }
+
+struct A {
+  int n;
+  int a [];
+};
+
+struct A foo (void)
+{
+  // Verify the initializer below is accepted for compatibility with gcc
+  // (in C mode).
+  static struct A
+    a = { 2, { 1, 0 } };   // { dg-warning "initialization of a flexible array member" }
+
+  return a;
+}