re PR c++/6037 (ICE in enum after switch() (gcc 3.0.4))
authorJakub Jelinek <jakub@redhat.com>
Sat, 23 Mar 2002 09:30:32 +0000 (10:30 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sat, 23 Mar 2002 09:30:32 +0000 (10:30 +0100)
PR c++/6037
* decl.c (start_enum): Don't set TREE_ADDRESSABLE on TREE_LIST node.

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

From-SVN: r51227

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

index dd97e041309011c980e05d73c6683845965ebff4..c61b19185fec948c8957bc9dc9fda3693db0eb0b 100644 (file)
@@ -1,3 +1,8 @@
+2002-03-23  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/6037
+       * decl.c (start_enum): Don't set TREE_ADDRESSABLE on TREE_LIST node.
+
 2002-03-23  Gabriel Dos Reis  <gdr@merlin.codesourcery.com>
 
        * error.c (dump_type): Be careful about implicit typenames.
index 06c82ab232a66cc79a961ef96d197ccf26d02006..9a3a053072579a8666b337d7630ae927a6d274bc 100644 (file)
@@ -13110,9 +13110,6 @@ start_enum (name)
       pushtag (name, enumtype, 0);
     }
 
-  if (current_class_type)
-    TREE_ADDRESSABLE (b->tags) = 1;
-
   return enumtype;
 }
 
index bb1cf789a1b3a4363cf09f1d1eb49248a3c93c66..4583119a2f77c12c1b04982f19213a52ae11f494 100644 (file)
@@ -1,3 +1,7 @@
+2002-03-23  Jakub Jelinek  <jakub@redhat.com>
+
+       * g++.dg/other/enum1.C: New test.
+
 2002-03-23  Zack Weinberg  <zack@codesourcery.com>
 
        * gcc.dg/pragma-ep-3.c: Fix typo.
diff --git a/gcc/testsuite/g++.dg/other/enum1.C b/gcc/testsuite/g++.dg/other/enum1.C
new file mode 100644 (file)
index 0000000..aa5c976
--- /dev/null
@@ -0,0 +1,19 @@
+// PR c++/6037
+// This testcase ICEd because start_enum expected pushtag to insert
+// the tag always into current binding level.
+
+struct A
+{
+  ~A () { }
+};
+
+struct B
+{
+  void foo ()
+  {
+    switch (0) { default: ; }
+    A a;
+    enum C { };
+    (void) a;
+  }
+};