PR14695: Fix assert from bad cast<>. Not every namespace is a NamespaceDecl; it might instead be a TranslationUnitDecl.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170976 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaTemplate/dependent-names.cpp b/test/SemaTemplate/dependent-names.cpp
index 7ef12b8..eb75e69 100644
--- a/test/SemaTemplate/dependent-names.cpp
+++ b/test/SemaTemplate/dependent-names.cpp
@@ -360,3 +360,12 @@
     tempf(x, y);  // expected-note{{in instantiation of}}
   }
 }
+
+// This test must live in the global namespace.
+struct PR14695_X {};
+// FIXME: This note is bogus; it is the using directive which would need to move
+// to prior to the call site to fix the problem.
+namespace PR14695_A { void PR14695_f(PR14695_X); } // expected-note {{'PR14695_f' should be declared prior to the call site or in the global namespace}}
+template<typename T> void PR14695_g(T t) { PR14695_f(t); } // expected-error {{call to function 'PR14695_f' that is neither visible in the template definition nor found by argument-dependent lookup}}
+using namespace PR14695_A;
+template void PR14695_g(PR14695_X); // expected-note{{requested here}}