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