This is the mail archive of the gcc-bugs@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: egcs-2.91.47 c++ new parsing bug?, function pointer


Thanks for your bug reports. This was introduced as a side-effect of
Koenig lookup. The code assumed that only functions can be found
during argument-dependent lookup. This was wrong, here is a patch.
A testcase was commited as g++.ns/koenig5.C.

Martin

1998-07-14  Martin von Löwis  <loewis@informatik.hu-berlin.de>

	* decl2.c (add_function): Move error message ...
	(arg_assoc_namespace): ... from here.

Index: decl2.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl2.c,v
retrieving revision 1.96
diff -c -p -r1.96 decl2.c
*** decl2.c	1998/07/12 16:55:16	1.96
--- decl2.c	1998/07/14 20:54:21
*************** add_function (k, fn)
*** 4140,4146 ****
  {
    if (ovl_member (fn, k->functions))
      return 0;
!   k->functions = build_overload (fn, k->functions);
    return 0;
  }
  
--- 4149,4174 ----
  {
    if (ovl_member (fn, k->functions))
      return 0;
!   /* We must find only functions, or exactly one non-function. */
!   if (k->functions && is_overloaded_fn (k->functions)
!       && is_overloaded_fn (fn))
!     k->functions = build_overload (fn, k->functions);
!   else 
!     if(k->functions)
!       {
! 	tree f1 = OVL_CURRENT (k->functions);
! 	tree f2 = fn;
! 	if (is_overloaded_fn (f1))
! 	  {
! 	    fn = f1; f1 = f2; f2 = fn;
! 	  }
! 	cp_error_at ("`%D' is not a function,", f1);
! 	cp_error_at ("  conflict with `%D'", f2);
! 	cp_error ("  in call to `%D'", k->name);
! 	return 1;
!       }
!     else
!       k->functions = fn;
    return 0;
  }
  
*************** arg_assoc_namespace (k, scope)
*** 4160,4172 ****
    value = namespace_binding (k->name, scope);
    if (!value)
      return 0;
-   
-   if (!is_overloaded_fn (value))
-     {
-       cp_error_at ("`%D' is not a function", value);
-       cp_error ("in call to `%D'", k->name);
-       return 1;
-     }
    
    for (; value; value = OVL_NEXT (value))
      if (add_function (k, OVL_CURRENT (value)))
--- 4188,4193 ----


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