xref: /llvm-project/clang/test/CXX/temp/temp.spec/temp.explicit/p6.cpp (revision c6e68daac0fa6e77a89f3ca72f266a528503dd1c)
18fbe78f6SDaniel Dunbar // RUN: %clang_cc1 -fsyntax-only -verify %s
2*c6e68daaSAndy Gibbs // expected-no-diagnostics
3969c2a23SDouglas Gregor 
4969c2a23SDouglas Gregor template<class T> class Array { /* ... */ };
sort(Array<T> & v)5969c2a23SDouglas Gregor template<class T> void sort(Array<T>& v) { }
6969c2a23SDouglas Gregor 
7969c2a23SDouglas Gregor // instantiate sort(Array<int>&) - template-argument deduced
8969c2a23SDouglas Gregor template void sort<>(Array<int>&);
9969c2a23SDouglas Gregor 
10969c2a23SDouglas Gregor template void sort(Array<long>&);
11969c2a23SDouglas Gregor 
f0(T,U *)12969c2a23SDouglas Gregor template<typename T, typename U> void f0(T, U*) { }
13969c2a23SDouglas Gregor 
14969c2a23SDouglas Gregor template void f0<int>(int, float*);
15969c2a23SDouglas Gregor template void f0<>(double, float*);
16d28f0412SDouglas Gregor 
17d28f0412SDouglas Gregor template<typename T> struct hash { };
18d28f0412SDouglas Gregor struct S {
operator ==S19d28f0412SDouglas Gregor   bool operator==(const S&) const { return false; }
20d28f0412SDouglas Gregor };
21d28f0412SDouglas Gregor 
22d28f0412SDouglas Gregor template<typename T> struct Hash_map {
MethodHash_map23d28f0412SDouglas Gregor   void Method(const T& x) { h(x); }
24d28f0412SDouglas Gregor   hash<T> h;
25d28f0412SDouglas Gregor };
26d28f0412SDouglas Gregor 
27d28f0412SDouglas Gregor Hash_map<S> *x;
foo()28d28f0412SDouglas Gregor const Hash_map<S> *foo() {
29d28f0412SDouglas Gregor   return x;
30d28f0412SDouglas Gregor }
31d28f0412SDouglas Gregor 
32d28f0412SDouglas Gregor template<> struct hash<S> {
operator ()hash33d28f0412SDouglas Gregor   int operator()(const S& k) const {
34d28f0412SDouglas Gregor     return 0;
35d28f0412SDouglas Gregor   }
36d28f0412SDouglas Gregor };
37