1 // RUN: %clang_cc1 -fsyntax-only -verify -pedantic -Wc++11-compat %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -pedantic -std=c++98 -Wc++11-compat %s
3 // RUN: %clang_cc1 -fsyntax-only -verify -pedantic -std=c++11 %s
5 // Example from the standard
6 template<class T
> class Array
{ void mf() { } };
8 template class Array
<char>;
9 template void Array
<int>::mf();
10 template<class T
> void sort(Array
<T
>& v
) { /* ... */ }
11 template void sort(Array
<char>&);
13 template<class T
> void f(T
&) { }
15 template void N::f
<int>(int&);
30 template struct XInt::Inner
; // expected-warning{{template-id}}
31 template void XInt::f(); // expected-warning{{template-id}}
32 template int XInt::value
; // expected-warning{{template-id}}
36 struct X1
{ // expected-note{{explicit instantiation refers here}}
40 void f1(T
) {} // expected-note{{explicit instantiation refers here}}
44 template struct X1
<int>;
45 #if __cplusplus <= 199711L
46 // expected-warning@-2 {{explicit instantiation of 'N::X1' must occur in namespace 'N'}}
48 // expected-error@-4 {{explicit instantiation of 'N::X1' must occur in namespace 'N'}}
51 template void f1(int);
52 #if __cplusplus <= 199711L
53 // expected-warning@-2 {{explicit instantiation of 'N::f1' must occur in namespace 'N'}}
55 // expected-error@-4 {{explicit instantiation of 'N::f1' must occur in namespace 'N'}}