Home | History | Annotate | Download | only in temp.deduct.call
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s
      2 
      3 template<typename T> struct A { };
      4 
      5 template<typename T> A<T> f0(T*);
      6 
      7 void test_f0(int *ip, float const *cfp) {
      8   A<int> a0 = f0(ip);
      9   A<const float> a1 = f0(cfp);
     10 }
     11 
     12 template<typename T> void f1(T*, int);
     13 
     14 void test_f1(int *ip, float fv) {
     15   f1(ip, fv);
     16 }
     17 
     18 // TODO: this diagnostic can and should improve
     19 template<typename T> void f2(T*, T*); // expected-note {{candidate template ignored: failed template argument deduction}} \
     20 // expected-note{{candidate template ignored: deduced conflicting types for parameter 'T' ('int' vs. 'float')}}
     21 
     22 struct ConvToIntPtr {
     23   operator int*() const;
     24 };
     25 
     26 void test_f2(int *ip, float *fp) {
     27   f2(ip, ConvToIntPtr()); // expected-error{{no matching function}}
     28   f2(ip, ip); // okay
     29   f2(ip, fp); // expected-error{{no matching function}}
     30 }
     31