1 // { dg-options "-fdiagnostics-show-caret" }
3 /* A collection of calls where argument 2 is of the wrong type. */
5 /* decl, with argname. */
7 extern int callee_1 (int one, const char **two, float three); // { dg-line callee_1 }
9 int test_1 (int first, const char *second, float third)
11 return callee_1 (first, second, third); // { dg-error "27: cannot convert 'const char\\*' to 'const char\\*\\*'" }
12 /* { dg-begin-multiline-output "" }
13 return callee_1 (first, second, third);
15 { dg-end-multiline-output "" } */
16 // { dg-message "initializing argument 2 of 'int callee_1\\(int, const char\\*\\*, float\\)'" "" { target *-*-* } callee_1 }
17 /* { dg-begin-multiline-output "" }
18 extern int callee_1 (int one, const char **two, float three);
20 { dg-end-multiline-output "" } */
23 /* decl, without argname. */
25 extern int callee_2 (int, const char **, float); // { dg-line callee_2 }
27 int test_2 (int first, const char *second, float third)
29 return callee_2 (first, second, third); // { dg-error "27: cannot convert 'const char\\*' to 'const char\\*\\*'" }
30 /* { dg-begin-multiline-output "" }
31 return callee_2 (first, second, third);
33 { dg-end-multiline-output "" } */
34 // { dg-message "initializing argument 2 of 'int callee_2\\(int, const char\\*\\*, float\\)'" "" { target *-*-* } callee_2 }
35 /* { dg-begin-multiline-output "" }
36 extern int callee_2 (int, const char **, float);
38 { dg-end-multiline-output "" } */
41 /* defn, with argname. */
43 static int callee_3 (int one, const char **two, float three) // { dg-line callee_3 }
45 return callee_2 (one, two, three);
48 int test_3 (int first, const char *second, float third)
50 return callee_3 (first, second, third); // { dg-error "27: cannot convert 'const char\\*' to 'const char\\*\\*'" }
51 /* { dg-begin-multiline-output "" }
52 return callee_3 (first, second, third);
54 { dg-end-multiline-output "" } */
55 // { dg-message "initializing argument 2 of 'int callee_3\\(int, const char\\*\\*, float\\)'" "" { target *-*-* } callee_3 }
56 /* { dg-begin-multiline-output "" }
57 static int callee_3 (int one, const char **two, float three)
59 { dg-end-multiline-output "" } */
62 /* static member, with argname. */
64 struct s4 { static int member_1 (int one, const char **two, float three); }; // { dg-line s4_member_1 }
66 int test_4 (int first, const char *second, float third)
68 return s4::member_1 (first, second, third); // { dg-error "no matching function for call to 's4::member_1\\(int&, const char\\*&, float&\\)'" }
69 /* { dg-begin-multiline-output "" }
70 return s4::member_1 (first, second, third);
72 { dg-end-multiline-output "" } */
73 // { dg-message "candidate: 'static int s4::member_1\\(int, const char\\*\\*, float\\)'" "" { target *-*-* } s4_member_1 }
74 /* { dg-begin-multiline-output "" }
75 struct s4 { static int member_1 (int one, const char **two, float three); };
77 { dg-end-multiline-output "" } */
78 // { dg-message "no known conversion for argument 2 from 'const char\\*' to 'const char\\*\\*'" "" { target *-*-* } s4_member_1 }
79 // TODO: underline the pertinent param
82 /* non-static member, with argname. */
84 struct s5 { int member_1 (int one, const char **two, float three); }; // { dg-line s5_member_1 }
86 int test_5 (int first, const char *second, float third)
89 return inst.member_1 (first, second, third); // { dg-error "no matching function for call to 's5::member_1\\(int&, const char\\*&, float&\\)'" }
90 /* { dg-begin-multiline-output "" }
91 return inst.member_1 (first, second, third);
93 { dg-end-multiline-output "" } */
94 // { dg-message "candidate: 'int s5::member_1\\(int, const char\\*\\*, float\\)'" "" { target *-*-* } s5_member_1 }
95 /* { dg-begin-multiline-output "" }
96 struct s5 { int member_1 (int one, const char **two, float three); };
98 { dg-end-multiline-output "" } */
99 // { dg-message "no known conversion for argument 2 from 'const char\\*' to 'const char\\*\\*'" "" { target *-*-* } s5_member_1 }
100 // TODO: underline the pertinent param
103 /* non-static member, with argname, via a ptr. */
105 struct s6 { int member_1 (int one, const char **two, float three); }; // { dg-line s6_member_1 }
107 int test_6 (int first, const char *second, float third, s6 *ptr)
109 return ptr->member_1 (first, second, third); // { dg-error "no matching function for call to 's6::member_1\\(int&, const char\\*&, float&\\)'" }
110 /* { dg-begin-multiline-output "" }
111 return ptr->member_1 (first, second, third);
113 { dg-end-multiline-output "" } */
114 // { dg-message "candidate: 'int s6::member_1\\(int, const char\\*\\*, float\\)'" "" { target *-*-* } s6_member_1 }
115 /* { dg-begin-multiline-output "" }
116 struct s6 { int member_1 (int one, const char **two, float three); };
118 { dg-end-multiline-output "" } */
119 // { dg-message "no known conversion for argument 2 from 'const char\\*' to 'const char\\*\\*'" "" { target *-*-* } s6_member_1 }
120 // TODO: underline the pertinent param
123 /* Template function. */
125 template <typename T>
126 int test_7 (int one, T two, float three); // { dg-line test_7_decl }
128 int test_7 (int first, const char *second, float third)
130 return test_7 <const char **> (first, second, third); // { dg-line test_7_usage }
131 // { dg-error "no matching function" "" { target *-*-* } test_7_usage }
132 /* { dg-begin-multiline-output "" }
133 return test_7 <const char **> (first, second, third);
135 { dg-end-multiline-output "" } */
136 // { dg-message "candidate: 'template<class T> int test_7\\(int, T, float\\)'" "" { target *-*-* } test_7_decl }
137 /* { dg-begin-multiline-output "" }
138 int test_7 (int one, T two, float three);
140 { dg-end-multiline-output "" } */
141 // { dg-message "template argument deduction/substitution failed:" "" { target *-*-* } test_7_decl }
142 // { dg-message "cannot convert 'second' \\(type 'const char\\*'\\) to type 'const char\\*\\*'" "" { target *-*-* } test_7_usage }
143 /* { dg-begin-multiline-output "" }
144 return test_7 <const char **> (first, second, third);
146 { dg-end-multiline-output "" } */
149 /* Template class, static function. */
151 template <typename T>
152 struct s8 { static int member_1 (int one, T two, float three); }; // { dg-line s8_member_1 }
154 int test_8 (int first, const char *second, float third)
156 return s8 <const char **>::member_1 (first, second, third); // { dg-error "no matching function for call to 's8<const char\\*\\*>::member_1\\(int&, const char\\*&, float&\\)'" }
157 /* { dg-begin-multiline-output "" }
158 return s8 <const char **>::member_1 (first, second, third);
160 { dg-end-multiline-output "" } */
161 // { dg-message "candidate: 'static int s8<T>::member_1\\(int, T, float\\)" "" { target *-*-* } s8_member_1 }
162 /* { dg-begin-multiline-output "" }
163 struct s8 { static int member_1 (int one, T two, float three); };
165 { dg-end-multiline-output "" } */
166 // { dg-message "no known conversion for argument 2 from 'const char\\*' to 'const char\\*\\*'" "" { target *-*-* } s8_member_1 }
167 // TODO: underline the pertinent param
170 /* Template class, non-static function. */
172 template <typename T>
173 struct s9 { int member_1 (int one, T two, float three); }; // { dg-line s9_member_1 }
175 int test_9 (int first, const char *second, float third)
177 s9 <const char **> inst;
178 return inst.member_1 (first, second, third); // { dg-error "no matching function for call to 's9<const char\\*\\*>::member_1\\(int&, const char\\*&, float&\\)'" }
179 /* { dg-begin-multiline-output "" }
180 return inst.member_1 (first, second, third);
182 { dg-end-multiline-output "" } */
183 // { dg-message "candidate: 'int s9<T>::member_1\\(int, T, float\\)" "" { target *-*-* } s9_member_1 }
184 /* { dg-begin-multiline-output "" }
185 struct s9 { int member_1 (int one, T two, float three); };
187 { dg-end-multiline-output "" } */
188 // { dg-message "no known conversion for argument 2 from 'const char\\*' to 'const char\\*\\*'" "" { target *-*-* } s9_member_1 }
189 // TODO: underline the pertinent param