Improve the semantic checking for explicit instantiations of
templates. In particular:
  - An explicit instantiation can follow an implicit instantiation (we
  were improperly diagnosing this as an error, previously).
  - In C++0x, an explicit instantiation that follows an explicit
  specialization of the same template specialization is ignored. In
  C++98, we just emit an extension warning.
  - In C++0x, an explicit instantiation must be in a namespace
  enclosing the original template. C++98 has no such requirement.

Also, fixed a longstanding FIXME regarding the integral type that is
used for the size of a constant array type when it is being instantiated.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71689 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaTemplate/temp_explicit_cxx0x.cpp b/test/SemaTemplate/temp_explicit_cxx0x.cpp
new file mode 100644
index 0000000..7045afc
--- /dev/null
+++ b/test/SemaTemplate/temp_explicit_cxx0x.cpp
@@ -0,0 +1,24 @@
+// RUN: clang-cc -fsyntax-only -std=c++0x -verify %s
+namespace N1 {
+
+  template<typename T> struct X0 { }; // expected-note{{here}}
+
+  namespace Inner {
+    template<typename T> struct X1 { };
+  }
+
+  template struct X0<int>;
+  template struct Inner::X1<int>;
+}
+
+template<typename T> struct X2 { }; // expected-note{{here}}
+
+template struct ::N1::Inner::X1<float>;
+
+namespace N2 {
+  using namespace N1;
+
+  template struct X0<double>; // expected-error{{not in a namespace enclosing}}
+
+  template struct X2<float>; // expected-error{{at global scope}}
+}