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