brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 33efac0 Raw
48 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2 3template<typename T> struct A { };4 5template<typename T> A<T> f0(T*);6 7void test_f0(int *ip, float const *cfp) {8  A<int> a0 = f0(ip);9  A<const float> a1 = f0(cfp);10}11 12template<typename T> void f1(T*, int);13 14void test_f1(int *ip, float fv) {15  f1(ip, fv);16}17 18template<typename T> void f2(T*, T*); // expected-note {{candidate template ignored: could not match 'T *' against 'ConvToIntPtr'}} \19// expected-note{{candidate template ignored: deduced conflicting types for parameter 'T' ('int' vs. 'float')}}20 21struct ConvToIntPtr {22  operator int*() const;23};24 25void test_f2(int *ip, float *fp) {26  f2(ip, ConvToIntPtr()); // expected-error{{no matching function}}27  f2(ip, ip); // okay28  f2(ip, fp); // expected-error{{no matching function}}29}30 31namespace test3 {32  template<typename T>33  struct bar { };34 35  template<typename T>36  struct foo {37    operator bar<T>();38  };39 40  template<typename T>41  void func(bar<T>) { // expected-note {{candidate template ignored: could not match 'bar' against 'foo'}}42  }43 44  void test() {45    func(foo<int>()); // expected-error {{no matching function}}46  }47}48