This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH: Fix PR 11786
- From: Mark Mitchell <mark at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 8 Sep 2003 12:09:59 -0700
- Subject: C++ PATCH: Fix PR 11786
- Reply-to: mark at codesourcery dot com
This simple patch fixes PR c++/11786, a problem whereby we got
confused by a type with an overloaded "operator()".
Tested on i686-pc-linux-gnu, applied on the mainline and on the
branch.
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
2003-09-08 Mark Mitchell <mark@codesourcery.com>
PR c++/11786
* decl2.c (add_function): Do not complain about seeing the same
non-function twice.
* semantics.c (perform_koenig_lookup): Improve documentation.
2003-09-08 Mark Mitchell <mark@codesourcery.com>
PR c++/11786
* g++.dg/lookup/koenig2.C: New test.
Index: decl2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl2.c,v
retrieving revision 1.669
retrieving revision 1.670
diff -c -5 -p -r1.669 -r1.670
*** decl2.c 8 Sep 2003 15:56:19 -0000 1.669
--- decl2.c 8 Sep 2003 18:46:15 -0000 1.670
*************** add_function (struct arg_lookup *k, tree
*** 3503,3512 ****
--- 3503,3514 ----
case. */
/* We must find only functions, or exactly one non-function. */
if (!k->functions)
k->functions = fn;
+ else if (fn == k->functions)
+ ;
else if (is_overloaded_fn (k->functions) && is_overloaded_fn (fn))
k->functions = build_overload (fn, k->functions);
else
{
tree f1 = OVL_CURRENT (k->functions);
Index: semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/semantics.c,v
retrieving revision 1.357
retrieving revision 1.358
diff -c -5 -p -r1.357 -r1.358
*** semantics.c 8 Sep 2003 15:56:27 -0000 1.357
--- semantics.c 8 Sep 2003 18:46:15 -0000 1.358
*************** finish_stmt_expr (tree rtl_expr, bool ha
*** 1532,1543 ****
}
return result;
}
/* Perform Koenig lookup. FN is the postfix-expression representing
! the call; ARGS are the arguments to the call. Returns the
! functions to be considered by overload resolution. */
tree
perform_koenig_lookup (tree fn, tree args)
{
tree identifier = NULL_TREE;
--- 1532,1544 ----
}
return result;
}
/* Perform Koenig lookup. FN is the postfix-expression representing
! the function (or functions) to call; ARGS are the arguments to the
! call. Returns the functions to be considered by overload
! resolution. */
tree
perform_koenig_lookup (tree fn, tree args)
{
tree identifier = NULL_TREE;
========== koenig2.C ============
struct S
{
template <typename T> void operator() (T) {}
};
namespace N
{
S s;
struct A {} a;
}
using N::s;
void f () { s(N::a); }