From: Gabriel Dos Reis Date: Sat, 13 Mar 2004 03:15:57 +0000 (+0000) Subject: backport: re PR c++/14476 (ICE after error about enum not being defined when using... X-Git-Tag: releases/gcc-3.3.4~163 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=45ee7c40111c820741237b6525f52de68d9c0b32;p=thirdparty%2Fgcc.git backport: re PR c++/14476 (ICE after error about enum not being defined when using it as a bit field) Backport: 2004-03-11 Mark Mitchell PR c++/14476 * decl.c (xref_tag): Do not create dummy ENUMERAL_TYPEs. From-SVN: r79431 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index cf29f936899d..99f5d2193f36 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2004-03-12 Gabriel Dos Reis + + Backport: + 2004-03-11 Mark Mitchell + PR c++/14476 + * decl.c (xref_tag): Do not create dummy ENUMERAL_TYPEs. + 2004-03-12 Gabriel Dos Reis Backport: diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 2862ee5fc8ac..f9a8e9957d88 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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 index 000000000000..054933dd9d36 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/enum2.C @@ -0,0 +1,5 @@ +// PR c++/14476 + +struct tree_common { + enum tree_code code : 8; // { dg-error "" } +};