p3-0x.cpp revision 8e8fb3be5bd78f0564444eca02b404566a5f3b5d
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
9namespace 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
50struct X3;
51struct X4;
52
53template void has_inline_namespaces::f(X3&);
54template void has_inline_namespaces::f<X4>(X4&);
55
56template struct has_inline_namespaces::X0<X3>;
57
58template struct has_inline_namespaces::X0<X4>::MemberClass;
59
60template void has_inline_namespaces::X0<X4>::mem_func();
61
62template
63struct has_inline_namespaces::X0<X4>::MemberClassTemplate<X3>;
64
65template
66void has_inline_namespaces::X0<X4>::mem_func_template(X3&);
67