PR c++/14476
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 11 Mar 2004 08:40:08 +0000 (08:40 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 11 Mar 2004 08:40:08 +0000 (08:40 +0000)
* decl.c (xref_tag): Do not create dummy ENUMERAL_TYPEs.

PR c++/14476
* g++.dg/lookup/enum1.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@79312 138bc75d-0d04-0410-961f-82ee72b054a4

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

index e642c26..29232f2 100644 (file)
@@ -9392,25 +9392,7 @@ xref_tag (enum tag_types tag_code, tree name,
       if (code == ENUMERAL_TYPE)
        {
          error ("use of enum `%#D' without previous declaration", name);
-
-         t = make_node (ENUMERAL_TYPE);
-
-         /* Give the type a default layout like unsigned int
-            to avoid crashing if it does not get defined.  */
-         TYPE_MODE (t) = TYPE_MODE (unsigned_type_node);
-         TYPE_ALIGN (t) = TYPE_ALIGN (unsigned_type_node);
-         TYPE_USER_ALIGN (t) = 0;
-         TREE_UNSIGNED (t) = 1;
-         TYPE_PRECISION (t) = TYPE_PRECISION (unsigned_type_node);
-         TYPE_MIN_VALUE (t) = TYPE_MIN_VALUE (unsigned_type_node);
-         TYPE_MAX_VALUE (t) = 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, t, globalize);
+         POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
        }
       else
        {
index df12379..fb762d5 100644 (file)
@@ -1,3 +1,8 @@
+2004-03-11  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/14476
+       * g++.dg/lookup/enum1.C: New test.
+
 2004-03-10  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/14510
diff --git a/gcc/testsuite/g++.dg/lookup/enum1.C b/gcc/testsuite/g++.dg/lookup/enum1.C
new file mode 100644 (file)
index 0000000..9422814
--- /dev/null
@@ -0,0 +1,5 @@
+// PR c++/14476
+
+struct tree_common {
+  enum tree_code code : 8; // { dg-error "" }
+};