re PR c++/11786 (operator() call on variable in other namespace not recognized)
authorMark Mitchell <mark@codesourcery.com>
Mon, 8 Sep 2003 18:46:20 +0000 (18:46 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Mon, 8 Sep 2003 18:46:20 +0000 (18:46 +0000)
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.

From-SVN: r71213

gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/lookup/koenig2.C [new file with mode: 0644]

index 13a5c55a718a4c0a1b49bc253d3806f0ff46491f..c02e8d19397763be83849dffe9b5e46171076c42 100644 (file)
@@ -1,5 +1,10 @@
 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.
+
        PR c++/5296
        * pt.c (try_one_overload): Add addr_p parameter.
        (resolve_overloaded_unification): Pass it.
index 209f793f06265aaee803a6b312fb858a5323f298..4004c8c80de65a63c4978aa56b88bae5a93cd61a 100644 (file)
@@ -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
index 8b765ef1697a7a9a3748c680e8cab31e7840aa82..e7392c03052f612ee2b2b8aeee5c73b970d3b047 100644 (file)
@@ -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)
index bf04edf5323eadd9c2d42e6c39e2d5cb24d722f8..3d9d3672faff1351e9cf6014a6e662488adc0ab5 100644 (file)
@@ -1,5 +1,8 @@
 2003-09-08  Mark Mitchell  <mark@codesourcery.com>
 
+       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 (file)
index 0000000..04f9525
--- /dev/null
@@ -0,0 +1,15 @@
+struct S
+{
+  template <typename T> void operator() (T) {}
+};
+
+namespace N
+{
+  S s;
+  struct A {} a;
+}
+
+using N::s;
+
+void f () { s(N::a); }
+