| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 |
// expected-no-diagnostics |
| 3 |
|
| 4 |
template<class T> class Array { /* ... */ }; |
| 5 |
template<class T> void sort(Array<T>& v) { } |
| 6 |
|
| 7 |
// instantiate sort(Array<int>&) - template-argument deduced |
| 8 |
template void sort<>(Array<int>&); |
| 9 |
|
| 10 |
template void sort(Array<long>&); |
| 11 |
|
| 12 |
template<typename T, typename U> void f0(T, U*) { } |
| 13 |
|
| 14 |
template void f0<int>(int, float*); |
| 15 |
template void f0<>(double, float*); |
| 16 |
|
| 17 |
template<typename T> struct hash { }; |
| 18 |
struct S { |
| 19 |
bool operator==(const S&) const { return false; } |
| 20 |
}; |
| 21 |
|
| 22 |
template<typename T> struct Hash_map { |
| 23 |
void Method(const T& x) { h(x); } |
| 24 |
hash<T> h; |
| 25 |
}; |
| 26 |
|
| 27 |
Hash_map<S> *x; |
| 28 |
const Hash_map<S> *foo() { |
| 29 |
return x; |
| 30 |
} |
| 31 |
|
| 32 |
template<> struct hash<S> { |
| 33 |
int operator()(const S& k) const { |
| 34 |
return 0; |
| 35 |
} |
| 36 |
}; |