| 1 |
// { dg-do run } |
| 2 |
extern "C" void abort(); |
| 3 |
|
| 4 |
template <class T> |
| 5 |
struct S1 |
| 6 |
{ |
| 7 |
static void f(); |
| 8 |
}; |
| 9 |
|
| 10 |
template <> |
| 11 |
void S1<int>::f() {} |
| 12 |
|
| 13 |
struct S2 |
| 14 |
{ |
| 15 |
template <class T> |
| 16 |
static void g(T); |
| 17 |
}; |
| 18 |
|
| 19 |
template <> |
| 20 |
void S2::g(double) {} |
| 21 |
|
| 22 |
template <> |
| 23 |
void S2::g<int>(int) {} |
| 24 |
|
| 25 |
template <class T> |
| 26 |
struct S3 |
| 27 |
{ |
| 28 |
template <class U> |
| 29 |
static int h(U); |
| 30 |
}; |
| 31 |
|
| 32 |
template <> |
| 33 |
template <> |
| 34 |
int S3<double>::h(int) { return 0; } |
| 35 |
|
| 36 |
template <> |
| 37 |
template <> |
| 38 |
int S3<char>::h(int) { return 1; } |
| 39 |
|
| 40 |
int main() |
| 41 |
{ |
| 42 |
S1<int>::f(); |
| 43 |
S2::g(3.0); |
| 44 |
S2::g(7); |
| 45 |
|
| 46 |
if (S3<double>::h(7) != 0) |
| 47 |
abort(); |
| 48 |
if (S3<char>::h(7) != 1) |
| 49 |
abort(); |
| 50 |
} |