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