1 // RUN: not %clang_cc1 -fdiagnostics-parseable-fixits -x c++ %s 2> %t
2 // RUN: FileCheck %s < %t
6 /* Test fixits for * and & mismatch in function arguments.
7 * Since fixits are on the notes, they cannot be applied automatically. */
17 // CHECK: error: no matching function for call to 'f1
18 // CHECK: dereference the argument with *
19 // CHECK: void f1(intTy &a);
20 // CHECK: fix-it{{.*}}*(
21 // CHECK-NEXT: fix-it{{.*}})
22 // CHECK: void f1(double *a);
25 // This call cannot be fixed since without resulting in null pointer dereference.
26 // CHECK: error: no matching function for call to 'f1
27 // CHECK-NOT: dereference the argument with *
33 // CHECK: error: no matching function for call to 'f0
34 // CHECK: fix-it{{.*}}&
39 void m(int *a
, const int *b
); // match 2
40 void m(double *a
, int *b
); // no match
41 void m(int *a
, double *b
); // no match
42 void m(intTy
&a
, int *b
); // match 1
44 void mcaller(intTy2 a
, int b
) {
45 // CHECK: error: no matching function for call to 'm
46 // CHECK: take the address of the argument with &
47 // CHECK: fix-it{{.*}}&
48 // CHECK: take the address of the argument with &
49 // CHECK: fix-it{{.*}}&
50 // CHECK: fix-it{{.*}}&
53 // This call cannot be fixed because (a + 1) is not an l-value.
54 // CHECK: error: no matching function for call to 'm
59 // Test derived to base conversions.
78 void dbcaller(A
*ptra
, B
*ptrb
, C
&c
, B
&refb
) {
81 // CHECK: error: no matching function for call to 'br
82 // CHECK: fix-it{{.*}}*
85 // CHECK: error: no matching function for call to 'bp
86 // CHECK: fix-it{{.*}}&
89 // CHECK: error: no matching function for call to 'dv
91 dv(ptra
); // bad: base to derived
93 // CHECK: error: no matching function for call to 'dv
97 // CHECK: error: no matching function for call to 'bp
101 // CHECK: error: no viable overloaded '='
105 // TODO: Test that we do not provide a fixit when inheritance is private.
106 // CHECK: error: no matching function for call to 'bp
107 // There should not be a fixit here:
111 // CHECK: no matching function for call to 'u'
112 // CHECK: candidate function not viable: no known conversion from 'C' to 'const C *' for 1st argument; take the address of the argument with &
113 // CHECK: candidate function not viable
114 // CHECK: candidate function not viable
118 void accept_void(void*);
120 void issue58958(const char* a
, volatile char * v
, const volatile char * cv
) {
121 // CHECK: no matching function for call to 'accept_void'
122 // CHECK-NOT: take the address of the argument with &
124 // CHECK: no matching function for call to 'accept_void'
125 // CHECK-NOT: take the address of the argument with &
127 // CHECK: no matching function for call to 'accept_void'
128 // CHECK-NOT: take the address of the argument with &
131 // CHECK: no matching function for call to 'accept_void'
132 // CHECK: take the address of the argument with &
134 // CHECK-NOT: no matching function for call to 'accept_void'
135 // CHECK-NOT: take the address of the argument with &
139 // CHECK: errors generated