]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR c++/14476 (ICE after error about enum not being defined when using...
authorGabriel Dos Reis <gdr@integrable-solutions.net>
Sat, 13 Mar 2004 03:15:57 +0000 (03:15 +0000)
committerGabriel Dos Reis <gdr@gcc.gnu.org>
Sat, 13 Mar 2004 03:15:57 +0000 (03:15 +0000)
Backport:
2004-03-11  Mark Mitchell  <mark@codesourcery.com>
PR c++/14476
* decl.c (xref_tag): Do not create dummy ENUMERAL_TYPEs.

From-SVN: r79431

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

index cf29f936899de2300c3730cbff1a4f203ffd6650..99f5d2193f36d91c06fb869fc1add1353dcd8b32 100644 (file)
@@ -1,3 +1,10 @@
+2004-03-12  Gabriel Dos Reis  <gdr@integrable-solutions.net>
+
+       Backport:
+       2004-03-11  Mark Mitchell  <mark@codesourcery.com>
+       PR c++/14476
+       * decl.c (xref_tag): Do not create dummy ENUMERAL_TYPEs.
+
 2004-03-12  Gabriel Dos Reis  <gdr@integrable-solutions.net>
 
        Backport:
index 2862ee5fc8aca27ea7b0cfdf46d1809e4aa3eb0a..f9a8e9957d88f062d89e3f3420651ff9b9a465d8 100644 (file)
@@ -13688,25 +13688,7 @@ xref_tag (enum tag_types tag_code, tree name, tree attributes,
       if (code == ENUMERAL_TYPE)
        {
          error ("use of enum `%#D' without previous declaration", name);
-
-         ref = make_node (ENUMERAL_TYPE);
-
-         /* Give the type a default layout like unsigned int
-            to avoid crashing if it does not get defined.  */
-         TYPE_MODE (ref) = TYPE_MODE (unsigned_type_node);
-         TYPE_ALIGN (ref) = TYPE_ALIGN (unsigned_type_node);
-         TYPE_USER_ALIGN (ref) = 0;
-         TREE_UNSIGNED (ref) = 1;
-         TYPE_PRECISION (ref) = TYPE_PRECISION (unsigned_type_node);
-         TYPE_MIN_VALUE (ref) = TYPE_MIN_VALUE (unsigned_type_node);
-         TYPE_MAX_VALUE (ref) = TYPE_MAX_VALUE (unsigned_type_node);
-
-         /* Enable us to recognize when a type is created in class context.
-            To do nested classes correctly, this should probably be cleared
-            out when we leave this classes scope.  Currently this in only
-            done in `start_enum'.  */
-
-         pushtag (name, ref, globalize);
+          POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
        }
       else
        {
diff --git a/gcc/testsuite/g++.dg/lookup/enum2.C b/gcc/testsuite/g++.dg/lookup/enum2.C
new file mode 100644 (file)
index 0000000..054933d
--- /dev/null
@@ -0,0 +1,5 @@
+// PR c++/14476
+
+struct tree_common {
+  enum tree_code code : 8;      // { dg-error "" }
+};