From 2166beba8d939d2938c5401af2c8d3687afd5d8c Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 11 May 2010 17:39:34 +0000 Subject: The C++98/03 standard is disturbingly silent about out-of-scope explicit instantiations of template. C++0x clarifies the intent (they're ill-formed in some cases; see [temp.explicit] for details). However, one could squint at the C++98/03 standard and conclude they are permitted, so reduce the error to a warning (controlled by -Wc++0x-compat) in C++98/03 mode. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103482 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/SemaTemplate/temp_explicit.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'test/SemaTemplate/temp_explicit.cpp') diff --git a/test/SemaTemplate/temp_explicit.cpp b/test/SemaTemplate/temp_explicit.cpp index fbb41ff601..76244c25e8 100644 --- a/test/SemaTemplate/temp_explicit.cpp +++ b/test/SemaTemplate/temp_explicit.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -Wc++0x-compat %s // // Tests explicit instantiation of templates. template class X0 { }; @@ -125,3 +125,27 @@ template <> // expected-warning{{extraneous template parameter list}} template <> struct Foo::Bar {}; + +namespace N1 { + + template struct X7 { }; // expected-note{{here}} + + namespace Inner { + template struct X8 { }; + } + + template struct X7; + template struct Inner::X8; +} + +template struct X9 { }; // expected-note{{here}} + +template struct ::N1::Inner::X8; + +namespace N2 { + using namespace N1; + + template struct X7; // expected-warning{{must occur in namespace}} + + template struct X9; // expected-warning{{must occur in the global}} +} -- cgit v1.2.1