1 // RUN: %clang_cc1 -fsyntax-only -verify -pedantic -Wc++11-compat %s 2 3 // Example from the standard 4 template<class T> class Array { void mf() { } }; 5 6 template class Array<char>; 7 template void Array<int>::mf(); 8 template<class T> void sort(Array<T>& v) { /* ... */ } 9 template void sort(Array<char>&); 10 namespace N { 11 template<class T> void f(T&) { } 12 } 13 template void N::f<int>(int&); 14 15 16 template<typename T> 17 struct X0 { 18 struct Inner {}; 19 void f() { } 20 static T value; 21 }; 22 23 template<typename T> 24 T X0<T>::value = 17; 25 26 typedef X0<int> XInt; 27 28 template struct XInt::Inner; // expected-warning{{template-id}} 29 template void XInt::f(); // expected-warning{{template-id}} 30 template int XInt::value; // expected-warning{{template-id}} 31 32 namespace N { 33 template<typename T> 34 struct X1 { // expected-note{{explicit instantiation refers here}} 35 }; 36 37 template<typename T> 38 void f1(T) {} // expected-note{{explicit instantiation refers here}} 39 } 40 using namespace N; 41 42 template struct X1<int>; // expected-warning{{must occur in}} 43 template void f1(int); // expected-warning{{must occur in}} 44