From b1ea83f465e14deee3ee10aed15d9cb12f914484 Mon Sep 17 00:00:00 2001 From: mmitchel Date: Mon, 8 Sep 2003 18:46:20 +0000 Subject: [PATCH] PR c++/11786 * decl2.c (add_function): Do not complain about seeing the same non-function twice. * semantics.c (perform_koenig_lookup): Improve documentation. PR c++/11786 * g++.dg/lookup/koenig2.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@71213 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/decl2.c | 2 ++ gcc/cp/semantics.c | 5 +++-- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/g++.dg/lookup/koenig2.C | 15 +++++++++++++++ 5 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/lookup/koenig2.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 13a5c55a718..c02e8d19397 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 2003-09-08 Mark Mitchell + PR c++/11786 + * decl2.c (add_function): Do not complain about seeing the same + non-function twice. + * semantics.c (perform_koenig_lookup): Improve documentation. + PR c++/5296 * pt.c (try_one_overload): Add addr_p parameter. (resolve_overloaded_unification): Pass it. diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 209f793f062..4004c8c80de 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -3505,6 +3505,8 @@ add_function (struct arg_lookup *k, tree fn) /* 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 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 8b765ef1697..e7392c03052 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1534,8 +1534,9 @@ finish_stmt_expr (tree rtl_expr, bool has_no_scope) } /* 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. */ + 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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bf04edf5323..3d9d3672faf 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2003-09-08 Mark Mitchell + PR c++/11786 + * g++.dg/lookup/koenig2.C: New test. + PR c++/5296 * g++.dg/rtti/typeid2.C: New test. diff --git a/gcc/testsuite/g++.dg/lookup/koenig2.C b/gcc/testsuite/g++.dg/lookup/koenig2.C new file mode 100644 index 00000000000..04f95258999 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/koenig2.C @@ -0,0 +1,15 @@ +struct S +{ + template void operator() (T) {} +}; + +namespace N +{ + S s; + struct A {} a; +} + +using N::s; + +void f () { s(N::a); } + -- 2.11.0