73 lines · cpp
1// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-print-source-range-info %s 2>&1 | FileCheck %s --strict-whitespace2// CHECK: error: no matching function3template <typename T> struct mcdata {4 typedef int result_type;5};6template <class T> typename mcdata<T>::result_type wrap_mean(mcdata<T> const &);7// CHECK: :{[[@LINE+1]]:19-[[@LINE+1]]:53}: note: {{.*}}: no overload of 'wrap_mean'8void add_property(double (*)(mcdata<double> const &));9void f() { add_property(&wrap_mean); }10 11// CHECK: error: no matching function12// CHECK: :{[[@LINE+1]]:10-[[@LINE+1]]:51}: note: {{.*}}: cannot pass pointer to generic address space13void baz(__attribute__((opencl_private)) int *Data) {}14void fizz() {15 int *Nop;16 baz(Nop);17 // CHECK: error: no matching function18 // CHECK: :[[@LINE+1]]:53: note: {{.*}}: 'this' object is in address space '__private'19 __attribute__((opencl_private)) static auto err = [&]() {};20 err();21}22 23// CHECK: error: no matching function24struct Bar {25// CHECK: :{[[@LINE+1]]:26-[[@LINE+1]]:32}: note: {{.*}} would lose const qualifier26static void foo(int num, int *X) {}27// CHECK: :{[[@LINE+1]]:17-[[@LINE+1]]:25}: note: {{.*}} no known conversion28static void foo(int *err, int *x) {}29};30void bar(const int *Y) {31 Bar::foo(5, Y);32}33 34struct InComp;35 36struct A {};37struct B : public A{};38// CHECK: error: no matching function39// CHECK: :{[[@LINE+5]]:36-[[@LINE+5]]:50}: note: {{.*}}: cannot convert initializer40// CHECK: error: no matching function41// CHECK: :{[[@LINE+3]]:36-[[@LINE+3]]:50}: note: {{.*}}: cannot convert argument42// CHECK: error: no matching function43// CHECK: :{[[@LINE+1]]:11-[[@LINE+1]]:18}: note: {{.*}}: no known conversion44void hoge(char aa, const char *bb, const A& third);45 46// CHECK: error: no matching function47// CHECK: :{[[@LINE+1]]:14-[[@LINE+1]]:16}: note: {{.*}}: cannot convert from base class48void derived(B*);49 50void func(const A &arg) {51 hoge(1, "pass", {{{arg}}});52 InComp *a;53 hoge(1, "pass", a);54 hoge("first", 5, 6);55 A *b;56 derived(b);57}58 59struct Q {60 // CHECK: error: invalid operands61 // CHECK: :[[@LINE+1]]:6: note: {{.*}}: 'this' argument has type 'const Q'62 Q &operator+(void*);63};64 65void fuga(const Q q) { q + 3; }66 67template <short T> class Type1 {};68// CHECK: error: no matching function69// CHECK: :{[[@LINE+1]]:43-[[@LINE+1]]:54}: note: {{.*}}: expects an lvalue70template <short T> void Function1(int zz, Type1<T> &x, int ww) {}71 72void Function() { Function1(33, Type1<-42>(), 66); }73