]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/58510 ([c++11] ICE with multiple non-static data initializations in union)
authorMarek Polacek <polacek@redhat.com>
Thu, 3 Oct 2013 16:33:23 +0000 (16:33 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Thu, 3 Oct 2013 16:33:23 +0000 (16:33 +0000)
PR c++/58510
cp/
* init.c (sort_mem_initializers): Splice when giving an error.
testsuite/
* g++.dg/cpp0x/pr58510.C: New test.

From-SVN: r203165

gcc/cp/ChangeLog
gcc/cp/init.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/pr58510.C [new file with mode: 0644]

index c984f9030f3815ca9831feb22aae8de607877818..0769847be94d0b66f34e79bb81350b55eb910637 100644 (file)
@@ -1,3 +1,8 @@
+2013-10-03  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/58510
+       * init.c (sort_mem_initializers): Splice when giving an error.
+
 2013-10-02  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/58535
index 8fabdcdb94886c9ad3482884d124146603338e9c..70e7294c4d35dcd71cd60d5d9cf2f944924370e4 100644 (file)
@@ -980,9 +980,12 @@ sort_mem_initializers (tree t, tree mem_inits)
              else if (TREE_VALUE (*last_p) && !TREE_VALUE (init))
                goto splice;
              else
-               error_at (DECL_SOURCE_LOCATION (current_function_decl),
-                         "initializations for multiple members of %qT",
-                         ctx);
+               {
+                 error_at (DECL_SOURCE_LOCATION (current_function_decl),
+                           "initializations for multiple members of %qT",
+                           ctx);
+                 goto splice;
+               }
            }
 
          last_p = p;
index 6ea99fb73ffaef7e25070c9ecc1375f3fbc7ec47..6e4a4e473219235946e8078cd5be38e89aa0d26b 100644 (file)
@@ -1,3 +1,8 @@
+2013-10-03  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/58510
+       * g++.dg/cpp0x/pr58510.C: New test.
+
 2013-10-03  Marc Glisse  <marc.glisse@inria.fr>
 
        PR c++/19476
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr58510.C b/gcc/testsuite/g++.dg/cpp0x/pr58510.C
new file mode 100644 (file)
index 0000000..71f2520
--- /dev/null
@@ -0,0 +1,11 @@
+// PR c++/58510
+// { dg-do compile { target c++11 } }
+
+void foo()
+{
+  union
+  {            // { dg-error "multiple" }
+    int i = 0;
+    char c = 0;
+  };
+}