Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.pt/explicit70.C

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