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] [PR3761] ICE in check_template_shadow


Hi,

A while ago I submitted a patch to fix bug 3761, and a thread
discussing this can be found through this link:

http://gcc.gnu.org/ml/gcc-patches/2003-08/msg01400.html

I have received more feedback through bugzilla and have implemented
some changes to the patch.  The original added some logic to
check_template_shadow to handle a TREE_LIST of ambiguous declarations.
The recommendation was to move the handling of ambiguous declarations
up into push_class_level_binding which is already prepared to handle
TREE_LISTs.  

To test this new patch, I have run make bootstrap and make
check-gcc-c++ on an i686-pc-linux-gnu target.



2004-02-01  Scott Brumbaugh  <scottb.lists@verizon.net>


	PR C++/3761

	* name-lookup.c (push_class_level_binding): Don't pass a
	TREE_LIST of ambiguous names to check_template_shadow as it
	only handles declarations. Instead, pull the declaration 
	out and pass that.



Index: gcc/cp/name-lookup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/name-lookup.c,v
retrieving revision 1.36
diff -c -3 -p -r1.36 name-lookup.c
*** gcc/cp/name-lookup.c	27 Jan 2004 20:35:59 -0000	1.36
--- gcc/cp/name-lookup.c	2 Feb 2004 18:34:03 -0000
*************** push_class_level_binding (tree name, tre
*** 2725,2731 ****
    /* Make sure that this new member does not have the same name
       as a template parameter.  */
    if (TYPE_BEING_DEFINED (current_class_type))
!     check_template_shadow (x);
  
    /* If this declaration shadows a declaration from an enclosing
       class, then we will need to restore IDENTIFIER_CLASS_VALUE when
--- 2725,2742 ----
    /* Make sure that this new member does not have the same name
       as a template parameter.  */
    if (TYPE_BEING_DEFINED (current_class_type))
!     {
!       tree decl = x;
! 
!       /* We could have been passed a tree list if this is an ambiguous
! 	 declaration. If so, pull the declaration out because
! 	 check_template_shadow will not handle a TREE_LIST. */
!       if (TREE_CODE (decl) == TREE_LIST 
! 	  && TREE_TYPE (decl) == error_mark_node)
! 	decl = TREE_VALUE (decl);
!       
!       check_template_shadow (decl);
!     }
  
    /* If this declaration shadows a declaration from an enclosing
       class, then we will need to restore IDENTIFIER_CLASS_VALUE when




// { dg-do compile }
//
// PR 3761

struct A {};
 
struct B {};
 
template <class T>
struct Foo : A, B
{
  void func(void);

    struct Nested
    {
      friend void Foo::func(void);
    };
};





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