This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] Fix PR c++/6037
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Jakub Jelinek <jakub at redhat dot com>, "jason at redhat dot com" <jason at redhat dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 22 Mar 2002 10:33:27 -0800
- Subject: Re: [C++ PATCH] Fix PR c++/6037
- References: <20020322160305.E32482@sunsite.ms.mff.cuni.cz>
--On Friday, March 22, 2002 04:03:05 PM +0100 Jakub Jelinek
<jakub@redhat.com> wrote:
> Hi!
>
> pushtag doesn't always insert the tag into current binding
> level, yet start_enum was expecting this...
> Ok to commit?
>
> 2002-03-22 Jakub Jelinek <jakub@redhat.com>
>
> PR c++/6037
> * decl.c (start_enum): Only set TREE_ADDRESSABLE tag if we actually
> pushed one. Don't expect it to be added always to current binding
> level.
>
> * g++.dg/other/enum1.C: New test.
>
> --- gcc/cp/decl.c.jj Mon Mar 18 23:23:53 2002
> +++ gcc/cp/decl.c Fri Mar 22 15:55:02 2002
> @@ -13107,11 +13107,18 @@ start_enum (name)
> {
> enumtype = make_node (ENUMERAL_TYPE);
> pushtag (name, enumtype, 0);
> + if (current_class_type)
> + {
> + /* pushtag might have pushed the tag into some other binding
> + level. */
> + while (b && (b->tags == NULL || TREE_VALUE (b->tags) != enumtype))
> + b = b->level_chain;
> + if (b == NULL)
> + abort ();
> + TREE_ADDRESSABLE (b->tags) = 1;
> + }
> }
I don't understand this change. What binding level did the enum get
put in to? Why not just call lookup_tag again after calling pushtag,
rather than manipulating binding levels directly?
> - if (current_class_type)
> - TREE_ADDRESSABLE (b->tags) = 1;
> -
What is the point of the TREE_ADDRESSABLE bits? I know they were
alread there, but I don't remember them. Should we really be using
some other macro that has a clearer name?
Thanks,
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com