1// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s 2 3template<typename T> void f0(T); // expected-note{{here}} 4template void f0(int); // expected-error{{explicit instantiation of undefined function template}} 5 6template<typename T> 7struct X0 { 8 struct Inner; 9 10 void f1(); // expected-note{{here}} 11 12 static T value; // expected-note{{here}} 13}; 14 15template void X0<int>::f1(); // expected-error{{explicit instantiation of undefined member function}} 16 17template int X0<int>::value; // expected-error{{explicit instantiation of undefined static data member}} 18 19template<> void f0(long); // expected-note{{previous template specialization is here}} 20template void f0(long); // expected-warning{{explicit instantiation of 'f0<long>' that occurs after an explicit specialization will be ignored}} 21 22template<> void X0<long>::f1(); // expected-note{{previous template specialization is here}} 23template void X0<long>::f1(); // expected-warning{{explicit instantiation of 'f1' that occurs after an explicit specialization will be ignored}} 24 25template<> struct X0<long>::Inner; // expected-note{{previous template specialization is here}} 26template struct X0<long>::Inner; // expected-warning{{explicit instantiation of 'Inner' that occurs after an explicit specialization will be ignored}} 27 28template<> long X0<long>::value; // expected-note{{previous template specialization is here}} 29template long X0<long>::value; // expected-warning{{explicit instantiation of 'value' that occurs after an explicit specialization will be ignored}} 30 31template<> struct X0<double>; // expected-note{{previous template specialization is here}} 32template struct X0<double>; // expected-warning{{explicit instantiation of 'X0<double>' that occurs after an explicit specialization will be ignored}} 33 34// PR 6458 35namespace test0 { 36 template <class T> class foo { 37 int compare(T x, T y); 38 }; 39 40 template <> int foo<char>::compare(char x, char y); 41 template <class T> int foo<T>::compare(T x, T y) { 42 // invalid at T=char; if we get a diagnostic here, we're 43 // inappropriately instantiating this template. 44 void *ptr = x; 45 } 46 extern template class foo<char>; // expected-warning {{extern templates are a C++11 extension}} 47 template class foo<char>; 48} 49