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]

Re: ICE namespace/template bug in egcs-2.93.10


> The following code produces an ICE with egcs-2.93.10 on
> alphaev56-dec-osf4.0d:

Thanks for your bug report. Below is a patch that fix this and another
bug.

Regards,
Martin

P.S. There is usually no need to resend a bug report after four
days. I saw your first report, and just didn't have the time to look
into it.

1999-03-03  Martin von L÷wis  <loewis@informatik.hu-berlin.de>

	* decl.c (push_overloaded_decl): Only overwrite the old binding if
	there was one.
	* decl2.c (do_local_using_decl): Fix loop termination.

namespace A{
 void foo(int){}
}
namespace B{
  void foo(bool){}
}

void bar()
{
  using B::foo;
  using A::foo;
  foo(true);
}

namespace Foo {
  template<class N> void Hello(N) {}
}

int main() {
  using Foo::Hello;
  Hello(4);
  bar();
}

Index: decl.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl.c,v
retrieving revision 1.315
diff -c -p -r1.315 decl.c
*** decl.c	1999/02/26 23:36:52	1.315
--- decl.c	1999/03/03 16:24:11
*************** push_overloaded_decl (decl, flags)
*** 4276,4286 ****
    else
      {
        /* We only create an OVERLOAD if there was a previous binding at
! 	 this level.  In that case, we need to remove the old binding
! 	 and replace it with the new binding.  We must also run
! 	 through the NAMES on the binding level where the name was
! 	 bound to update the chain.  */
!       if (TREE_CODE (new_binding) == OVERLOAD)
  	{
  	  tree *d;
  	  
--- 4276,4287 ----
    else
      {
        /* We only create an OVERLOAD if there was a previous binding at
! 	 this level, or if decl is a template. In the former case, we
! 	 need to remove the old binding and replace it with the new
! 	 binding.  We must also run through the NAMES on the binding
! 	 level where the name was bound to update the chain.  */
! 
!       if (TREE_CODE (new_binding) == OVERLOAD && old)
  	{
  	  tree *d;
  	  
Index: decl2.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl2.c,v
retrieving revision 1.187
diff -c -p -r1.187 decl2.c
*** decl2.c	1999/02/26 23:36:55	1.187
--- decl2.c	1999/03/03 16:24:16
*************** do_local_using_decl (decl)
*** 4833,4843 ****
      {
        if (is_overloaded_fn (newval))
  	{
! 	  tree fn;
  
  	  /* We only need to push declarations for those functions
! 	     that were not already bound in the current level.  */
! 	  for (fn = newval; fn != oldval; fn = OVL_NEXT (fn))
  	    push_overloaded_decl (OVL_CURRENT (fn), 
  				  PUSH_LOCAL | PUSH_USING);
  	}
--- 4833,4850 ----
      {
        if (is_overloaded_fn (newval))
  	{
! 	  tree fn, term;
  
  	  /* We only need to push declarations for those functions
! 	     that were not already bound in the current level.
! 	     The old value might be NULL_TREE, it might be a single
! 	     function, or an OVERLOAD.  */
! 	  if (oldval && TREE_CODE (oldval) == OVERLOAD)
! 	    term = OVL_FUNCTION (oldval);
! 	  else
! 	    term = oldval;
! 	  for (fn = newval; fn && OVL_CURRENT (fn) != term; 
! 	       fn = OVL_NEXT (fn))
  	    push_overloaded_decl (OVL_CURRENT (fn), 
  				  PUSH_LOCAL | PUSH_USING);
  	}


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