Refactor the checking for explicit template instantiations being performed in
the right namespace in C++11 mode. Teach the code to prefer the 'must be in
precisely this namespace' diagnostic whenever that's true, and fix a defect
which resulted in the -Wc++11-compat warning in C++98 mode sometimes being
omitted.

llvm-svn: 142329
diff --git a/clang/test/SemaTemplate/temp_explicit.cpp b/clang/test/SemaTemplate/temp_explicit.cpp
index 76244c2..8a56d72 100644
--- a/clang/test/SemaTemplate/temp_explicit.cpp
+++ b/clang/test/SemaTemplate/temp_explicit.cpp
@@ -80,7 +80,7 @@
     void f(T&);
   };
 
-  struct Inner2 {
+  struct Inner2 { // expected-note {{here}}
     struct VeryInner {
       void g(T*); // expected-error 2{{pointer to a reference}}
     };
@@ -98,7 +98,7 @@
 template struct X5<float&>::Inner2; // expected-note{{instantiation}}
 
 namespace N3 {
-  template struct N2::X5<int>::Inner2;
+  template struct N2::X5<int>::Inner2; // expected-warning {{explicit instantiation of 'Inner2' not in a namespace enclosing 'N2'}}
 }
 
 struct X6 {
@@ -147,5 +147,5 @@
 
   template struct X7<double>; // expected-warning{{must occur in namespace}}
 
-  template struct X9<float>; // expected-warning{{must occur in the global}}
+  template struct X9<float>; // expected-warning{{must occur at global scope}}
 }