Fix PR10187: when diagnosing a two-phase-lookup-related failure, don't assert that any names we find are valid candidates for the call.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133898 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaTemplate/dependent-names.cpp b/test/SemaTemplate/dependent-names.cpp
index f778bd9..7bab5d1 100644
--- a/test/SemaTemplate/dependent-names.cpp
+++ b/test/SemaTemplate/dependent-names.cpp
@@ -262,3 +262,33 @@
     }
   }
 }
+
+namespace PR10187 {
+  namespace A {
+    template<typename T>
+    struct S {
+      void f() {
+        for (auto &a : e)
+          __range(a); // expected-error {{undeclared identifier '__range'}}
+      }
+      int e[10];
+    };
+    void g() {
+      S<int>().f(); // expected-note {{here}}
+    }
+  }
+
+  namespace B {
+    template<typename T> void g(); // expected-note {{not viable}}
+    template<typename T> void f() {
+      g<int>(T()); // expected-error {{no matching function}}
+    }
+
+    namespace {
+      struct S {};
+    }
+    void g(S);
+
+    template void f<S>(); // expected-note {{here}}
+  }
+}