llvm-capstone/clang/test/SemaTemplate/temp_explicit_cxx0x.cpp
Richard Smith 050d261ec7 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
2011-10-18 02:28:33 +00:00

25 lines
554 B
C++

// RUN: %clang_cc1 -fsyntax-only -std=c++11 -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{{must occur in namespace 'N1'}}
template struct X2<float>; // expected-error{{at global scope}}
}