]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/27951 (ICE with invalid anonymous union)
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>
Mon, 12 Jun 2006 21:00:31 +0000 (21:00 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Mon, 12 Jun 2006 21:00:31 +0000 (21:00 +0000)
PR c++/27951
* decl2.c (finish_anon_union): Return early if build_anon_union_vars
fails.

* g++.dg/other/anon4.C: New test.

From-SVN: r114579

gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/anon4.C [new file with mode: 0644]

index 9b2715c199aafe7136dbd70357f2b8583c6002f5..7016c34afee952b4bd04ffbc22c067b1fa797b0b 100644 (file)
@@ -1,3 +1,9 @@
+2006-06-12  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/27951
+       * decl2.c (finish_anon_union): Return early if build_anon_union_vars
+       fails.
+
 2006-06-07  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        PR c++/27601
index 1d061aeca99ba6ede878277f9443c8ed3590c950..f7c6675cf4794e36b8e00cc1b8a40c24826c23bb 100644 (file)
@@ -1183,6 +1183,8 @@ finish_anon_union (tree anon_union_decl)
     }
 
   main_decl = build_anon_union_vars (type, anon_union_decl);
+  if (main_decl == error_mark_node)
+    return;
   if (main_decl == NULL_TREE)
     {
       warning ("anonymous union with no members");
index 55f39720f4245c272b8885b636a138c832d5a919..01844c771ec5ee3fefbadf9f9dadad803b6d98bb 100644 (file)
@@ -1,3 +1,8 @@
+2006-06-12  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/27951
+       * g++.dg/other/anon4.C: New test.
+
 2006-06-07  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        PR c++/27601
diff --git a/gcc/testsuite/g++.dg/other/anon4.C b/gcc/testsuite/g++.dg/other/anon4.C
new file mode 100644 (file)
index 0000000..571f4ae
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/27951
+// { dg-do compile }
+
+void foo()
+{
+    int i;             // { dg-error "previously" }
+    union { int i; };  // { dg-error "redeclaration" }
+}