p3-0x.cpp revision cc20945c787a56abe418947fc6a2c520bcec66c0
1// RUN: %clang_cc1 -std=c++0x -verify %s 2 3// If the name declared in the explicit instantiation is an 4// unqualified name, the explicit instantiation shall appear in the 5// namespace where its template is declared or, if that namespace is 6// inline (7.3.1), any namespace from its enclosing namespace set. 7 8namespace has_inline_namespaces { 9 inline namespace inner { 10 template<class T> void f(T&) {} 11 12 template<class T> 13 struct X0 { 14 struct MemberClass {}; 15 16 void mem_func() {} 17 18 template<typename U> 19 struct MemberClassTemplate {}; 20 21 template<typename U> 22 void mem_func_template(U&) {} 23 24 static int value; 25 }; 26 } 27 28 template<typename T> int X0<T>::value = 17; 29 30 struct X1 {}; 31 struct X2 {}; 32 33 template void f(X1&); 34 template void f<X2>(X2&); 35 36 template struct X0<X1>; 37 38 template struct X0<X2>::MemberClass; 39 40 template void X0<X2>::mem_func(); 41 42 template struct X0<X2>::MemberClassTemplate<X1>; 43 44 template void X0<X2>::mem_func_template(X1&); 45 46 template int X0<X2>::value; 47} 48 49struct X3; 50struct X4; 51 52template void has_inline_namespaces::f(X3&); 53template void has_inline_namespaces::f<X4>(X4&); 54 55template struct has_inline_namespaces::X0<X3>; 56 57template struct has_inline_namespaces::X0<X4>::MemberClass; 58 59template void has_inline_namespaces::X0<X4>::mem_func(); 60 61template 62struct has_inline_namespaces::X0<X4>::MemberClassTemplate<X3>; 63 64template 65void has_inline_namespaces::X0<X4>::mem_func_template(X3&); 66