1// { dg-do assemble } 2 3template <class T> 4void f(T) {} 5 6template <class T> 7struct S { 8 static T t; 9}; 10 11template <class T> 12T S<T>::t; 13 14template void f(int); 15template void f(int); // { dg-error "duplicate explicit instantiation" } 16template int S<int>::t; 17template int S<int>::t; // { dg-error "duplicate explicit instantiation" } 18template class S<double>; 19template class S<double>; // { dg-error "duplicate explicit instantiation" } 20 21extern template void f(double); // { dg-error "extern" } extern not allowed 22inline template class S<float>; // { dg-error "inline" } inline not allowed 23 24template <class T> 25struct S<T*> {}; 26 27template class S<void*>; // OK - explicit instantiation of partial 28 // specialization 29 30template <> 31struct S<long double> {}; 32 33template class S<long double>; // OK - explicit instantiation after 34 35template <> 36void f(long double) {} 37 38template void f(long double); // OK - explicit instantiation after 39 40template <class T> 41void g(T); 42 43template void g(int); // { dg-error "no definition available" "no def" } 44// { dg-message "instantiated" "inst" { target *-*-* } 43 } 45