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


Mark,
your 2002-08-01 patch concerning lookups broke the attached testcase. Fixed
with the attached tweak. It seems to me that TEMPLATE_DECLs should always
be considered overloaded too. I think is_really_overloaded is a rather
fragile design anyway ...

booted and tested on i686-pc-linux-gnu, ok?

nathan
--
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org

// { dg-do compile }

// Copyright (C) 2002 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 29 Sep 2002 <nathan@codesourcery.com>

struct X
{
  template<typename T> static void ProcessProxy ();
  typedef void (*Callback) ();
  void Process (Callback);
  
  template<typename T> void Process ()
  {
    Process (&ProcessProxy<T>);
  }
  
};

void foo (X *x)
{
  x->Process<int> ();
}
2002-09-30  Nathan Sidwell  <nathan@codesourcery.com>

	* tree.c (really_overloaded_fn): TEMPLATE_ID_EXPRs are also
	overloaded.

Index: cp/tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/tree.c,v
retrieving revision 1.301
diff -c -3 -p -r1.301 tree.c
*** cp/tree.c	21 Sep 2002 12:51:56 -0000	1.301
--- cp/tree.c	30 Sep 2002 15:44:07 -0000
*************** really_overloaded_fn (x)
*** 1012,1020 ****
      x = TREE_OPERAND (x, 1);
    if (BASELINK_P (x))
      x = BASELINK_FUNCTIONS (x);
!   return (TREE_CODE (x) == OVERLOAD 
! 	  && (OVL_CHAIN (x)
! 	      || DECL_FUNCTION_TEMPLATE_P (OVL_FUNCTION (x))));
  }
  
  /* Return the OVERLOAD or FUNCTION_DECL inside FNS.  FNS can be an
--- 1012,1021 ----
      x = TREE_OPERAND (x, 1);
    if (BASELINK_P (x))
      x = BASELINK_FUNCTIONS (x);
!   
!   return ((TREE_CODE (x) == OVERLOAD && OVL_CHAIN (x))
! 	  || DECL_FUNCTION_TEMPLATE_P (OVL_CURRENT (x))
! 	  || TREE_CODE (x) == TEMPLATE_ID_EXPR);
  }
  
  /* Return the OVERLOAD or FUNCTION_DECL inside FNS.  FNS can be an

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