This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH] Fix PR c++/6037




--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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]