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]

[c++ patch] Fix PR 10405


Hi,
I've installed this obvious fix for PR 10405. (both HEAD and 3.3 branch)
I suspect the regression was introduced by

2003-03-30 Mark Mitchell <mark at codesourcery dot com>

	PR c++/7647
	* decl.c (grokdeclarator): Tidy, slightly.
	* search.c (lookup_field_1): Add want_type parameter.
	(lookup_field_r): Adjust call to lookup_field_1.
tha being the most recent change to lookup_field_1

booted and tested on i686-pc-linux-gnu.

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
         The voices in my head said this was stupid too
nathan at codesourcery dot com : http://www.cs.bris.ac.uk/~nathan/ : nathan at acm dot org

2003-04-19  Nathan Sidwell  <nathan at codesourcery dot com>

	PR c++/10405
	* search.c (lookup_field_1): Final scan goes backwards for
	types, forwards for non-types.

Index: cp/search.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/search.c,v
retrieving revision 1.258
diff -c -3 -p -r1.258 search.c
*** cp/search.c	30 Mar 2003 22:30:53 -0000	1.258
--- cp/search.c	19 Apr 2003 20:05:05 -0000
*************** lookup_field_1 (tree type, tree name, bo
*** 472,490 ****
  
  	      /* We might have a nested class and a field with the
  		 same name; we sorted them appropriately via
! 		 field_decl_cmp, so just look for the last field with
! 		 this name.  */
! 	      while (true)
  		{
! 		  if (!want_type 
! 		      || TREE_CODE (fields[i]) == TYPE_DECL
! 		      || DECL_CLASS_TEMPLATE_P (fields[i]))
! 		    field = fields[i];
! 		  if (i + 1 == hi || DECL_NAME (fields[i+1]) != name)
! 		    break;
! 		  i++;
  		}
- 
  	      return field;
  	    }
  	}
--- 472,494 ----
  
  	      /* We might have a nested class and a field with the
  		 same name; we sorted them appropriately via
! 		 field_decl_cmp, so just look for the first or last
! 		 field with this name.  */
! 	      if (want_type)
  		{
! 		  do
! 		    field = fields[i--];
! 		  while (i >= lo && DECL_NAME (fields[i]) == name);
! 		  if (TREE_CODE (field) != TYPE_DECL
! 		      && !DECL_CLASS_TEMPLATE_P (field))
! 		    field = NULL_TREE;
! 		}
! 	      else
! 		{
! 		  do
! 		    field = fields[i++];
! 		  while (i < hi && DECL_NAME (fields[i]) == name);
  		}
  	      return field;
  	    }
  	}
// { dg-do compile }

// Copyright (C) 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 19 Apr 2003 <nathan at codesourcery dot com>

// PR 10405. ICE

#define MEM_ENUM(name) int name; enum name {};

struct Base
{
  MEM_ENUM (a)
  MEM_ENUM (b)
  MEM_ENUM (c)
  MEM_ENUM (d)
  MEM_ENUM (e)
  MEM_ENUM (f)
  MEM_ENUM (g)
  MEM_ENUM (h)
  MEM_ENUM (i)
  MEM_ENUM (j)
  MEM_ENUM (k)
  MEM_ENUM (l)
  MEM_ENUM (m)
  MEM_ENUM (n)
  MEM_ENUM (o)
  MEM_ENUM (p)
  MEM_ENUM (q)
  MEM_ENUM (r)
  MEM_ENUM (s)
  MEM_ENUM (t)
  MEM_ENUM (u)
  MEM_ENUM (v)
  MEM_ENUM (w)
    };

struct D : Base  {};


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