Fix our semantic analysis of

  unqualified-id '('

in C++. The unqualified-id might not refer to any declaration in our
current scope, but declarations by that name might be found via
argument-dependent lookup. We now do so properly.

As part of this change, CXXDependentNameExpr, which was previously
designed to express the unqualified-id in the above constructor within
templates, has become UnresolvedFunctionNameExpr, which does
effectively the same thing but will work for both templates and
non-templates.

Additionally, we cope with all unqualified-ids, since ADL also applies
in cases like

  operator+(x, y)




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63733 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/basic_lookup_argdep.cpp b/test/SemaCXX/basic_lookup_argdep.cpp
index 67f2b65..53448d1 100644
--- a/test/SemaCXX/basic_lookup_argdep.cpp
+++ b/test/SemaCXX/basic_lookup_argdep.cpp
@@ -6,7 +6,7 @@
   X operator+(X, X);
 
   void f(X);
-  void g(X);
+  void g(X); // expected-note{{candidate function}}
 
   void test_multiadd(X x) {
     (void)(x + x);
@@ -39,7 +39,22 @@
 
 
 void test_func_adl_only(N::X x) {
-  // FIXME: here, despite the fact that the name lookup for 'g' fails,
-  // this is well-formed code. The fix will go into Sema::ActOnCallExpr.
-  //  g(x);
+  g(x);
+}
+
+namespace M {
+  int g(N::X); // expected-note{{candidate function}}
+
+  void test(N::X x) {
+    g(x); // expected-error{{call to 'g' is ambiguous; candidates are:}}
+    int i = (g)(x);
+
+    int g(N::X);
+    g(x); // okay; calls locally-declared function, no ADL
+  }
+}
+
+
+void test_operator_name_adl(N::X x) {
+  (void)operator+(x, x);
 }
diff --git a/test/SemaCXX/conversion-function.cpp b/test/SemaCXX/conversion-function.cpp
index 17e73bc..f9dd600 100644
--- a/test/SemaCXX/conversion-function.cpp
+++ b/test/SemaCXX/conversion-function.cpp
@@ -9,7 +9,7 @@
   }
 
   float g() {
-    return operator float(); // expected-error{{use of undeclared 'operator float'}}
+    return operator float(); // expected-error{{no matching function for call to 'operator float'}}
   }
 };
 
diff --git a/test/SemaCXX/type-dependent-exprs.cpp b/test/SemaCXX/type-dependent-exprs.cpp
index b3bfa8b..7c2de69 100644
--- a/test/SemaCXX/type-dependent-exprs.cpp
+++ b/test/SemaCXX/type-dependent-exprs.cpp
@@ -19,6 +19,6 @@
   return g(x);
   h(x); // h is a dependent name
   g(1, 1); // expected-error{{no matching function for call}}
-  h(1); // expected-error{{use of undeclared identifier 'h'}}
+  h(1); // expected-error{{no matching function for call to 'h'}}
   return 0;
 }