• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -fsyntax-only %s -std=c++11 2>&1 | FileCheck %s -check-prefix=CHECK-ELIDE-NOTREE
2 // RUN: %clang_cc1 -fsyntax-only %s -fno-elide-type -std=c++11 2>&1 | FileCheck %s -check-prefix=CHECK-NOELIDE-NOTREE
3 // RUN: %clang_cc1 -fsyntax-only %s -fdiagnostics-show-template-tree -std=c++11 2>&1 | FileCheck %s -check-prefix=CHECK-ELIDE-TREE
4 // RUN: %clang_cc1 -fsyntax-only %s -fno-elide-type -fdiagnostics-show-template-tree -std=c++11 2>&1 | FileCheck %s -check-prefix=CHECK-NOELIDE-TREE
5 
6 // PR9548 - "no known conversion from 'vector<string>' to 'vector<string>'"
7 // vector<string> refers to two different types here.  Make sure the message
8 // gives a way to tell them apart.
9 class versa_string;
10 typedef versa_string string;
11 
12 namespace std {template <typename T> class vector;}
13 using std::vector;
14 
15 void f(vector<string> v);
16 
17 namespace std {
18   class basic_string;
19   typedef basic_string string;
20   template <typename T> class vector {};
g()21   void g() {
22     vector<string> v;
23     f(v);
24   }
25 } // end namespace std
26 // CHECK-ELIDE-NOTREE: no matching function for call to 'f'
27 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<class std::basic_string>' to 'vector<class versa_string>' for 1st argument
28 // CHECK-NOELIDE-NOTREE: no matching function for call to 'f'
29 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<class std::basic_string>' to 'vector<class versa_string>' for 1st argument
30 // CHECK-ELIDE-TREE: no matching function for call to 'f'
31 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
32 // CHECK-ELIDE-TREE:   vector<
33 // CHECK-ELIDE-TREE:     [class std::basic_string != class versa_string]>
34 // CHECK-NOELIDE-TREE: no matching function for call to 'f'
35 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
36 // CHECK-NOELIDE-TREE:   vector<
37 // CHECK-NOELIDE-TREE:     [class std::basic_string != class versa_string]>
38 
39 template <int... A>
40 class I1{};
set1(I1<1,2,3,4,2,3,4,3>)41 void set1(I1<1,2,3,4,2,3,4,3>) {};
test1()42 void test1() {
43   set1(I1<1,2,3,4,2,2,4,3,7>());
44 }
45 // CHECK-ELIDE-NOTREE: no matching function for call to 'set1'
46 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'I1<[5 * ...], 2, [2 * ...], 7>' to 'I1<[5 * ...], 3, [2 * ...], (no argument)>' for 1st argument
47 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set1'
48 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'I1<1, 2, 3, 4, 2, 2, 4, 3, 7>' to 'I1<1, 2, 3, 4, 2, 3, 4, 3, (no argument)>' for 1st argument
49 // CHECK-ELIDE-TREE: no matching function for call to 'set1'
50 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
51 // CHECK-ELIDE-TREE:   I1<
52 // CHECK-ELIDE-TREE:     [5 * ...],
53 // CHECK-ELIDE-TREE:     [2 != 3],
54 // CHECK-ELIDE-TREE:     [2 * ...],
55 // CHECK-ELIDE-TREE:     [7 != (no argument)]>
56 // CHECK-NOELIDE-TREE: no matching function for call to 'set1'
57 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
58 // CHECK-NOELIDE-TREE:   I1<
59 // CHECK-NOELIDE-TREE:     1,
60 // CHECK-NOELIDE-TREE:     2,
61 // CHECK-NOELIDE-TREE:     3,
62 // CHECK-NOELIDE-TREE:     4,
63 // CHECK-NOELIDE-TREE:     2,
64 // CHECK-NOELIDE-TREE:     [2 != 3],
65 // CHECK-NOELIDE-TREE:     4,
66 // CHECK-NOELIDE-TREE:     3,
67 // CHECK-NOELIDE-TREE:     [7 != (no argument)]>
68 
69 template <class A, class B, class C = void>
70 class I2{};
set2(I2<int,int>)71 void set2(I2<int, int>) {};
test2()72 void test2() {
73   set2(I2<double, int, int>());
74 }
75 // CHECK-ELIDE-NOTREE: no matching function for call to 'set2'
76 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'I2<double, [...], int>' to 'I2<int, [...], (default) void>' for 1st argument
77 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set2'
78 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'I2<double, int, int>' to 'I2<int, int, (default) void>' for 1st argument
79 // CHECK-ELIDE-TREE: no matching function for call to 'set2'
80 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
81 // CHECK-ELIDE-TREE:   I2<
82 // CHECK-ELIDE-TREE:     [double != int],
83 // CHECK-ELIDE-TREE:     [...],
84 // CHECK-ELIDE-TREE:     [int != (default) void]>
85 // CHECK-NOELIDE-TREE: no matching function for call to 'set2'
86 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
87 // CHECK-NOELIDE-TREE:   I2<
88 // CHECK-NOELIDE-TREE:     [double != int],
89 // CHECK-NOELIDE-TREE:     int,
90 // CHECK-NOELIDE-TREE:     [int != (default) void]>
91 
92 int V1, V2, V3;
93 template <int* A, int *B>
94 class I3{};
set3(I3<& V1,& V2>)95 void set3(I3<&V1, &V2>) {};
test3()96 void test3() {
97   set3(I3<&V3, &V2>());
98 }
99 // CHECK-ELIDE-NOTREE: no matching function for call to 'set3'
100 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'I3<&V3, [...]>' to 'I3<&V1, [...]>' for 1st argument
101 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set3'
102 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'I3<&V3, &V2>' to 'I3<&V1, &V2>' for 1st argument
103 // CHECK-ELIDE-TREE: no matching function for call to 'set3'
104 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
105 // CHECK-ELIDE-TREE:   I3<
106 // CHECK-ELIDE-TREE:     [&V3 != &V1]
107 // CHECK-ELIDE-TREE:     [...]>
108 // CHECK-NOELIDE-TREE: no matching function for call to 'set3'
109 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
110 // CHECK-NOELIDE-TREE:   I3<
111 // CHECK-NOELIDE-TREE:     [&V3 != &V1]
112 // CHECK-NOELIDE-TREE:     &V2>
113 
114 template <class A, class B>
115 class Alpha{};
116 template <class A, class B>
117 class Beta{};
118 template <class A, class B>
119 class Gamma{};
120 template <class A, class B>
121 class Delta{};
122 
123 void set4(Alpha<int, int>);
test4()124 void test4() {
125   set4(Beta<void, void>());
126 }
127 // CHECK-ELIDE-NOTREE: no matching function for call to 'set4'
128 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'Beta<void, void>' to 'Alpha<int, int>' for 1st argument
129 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set4'
130 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'Beta<void, void>' to 'Alpha<int, int>' for 1st argument
131 // CHECK-ELIDE-TREE: no matching function for call to 'set4'
132 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from 'Beta<void, void>' to 'Alpha<int, int>' for 1st argument
133 // CHECK-NOELIDE-TREE: no matching function for call to 'set4'
134 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from 'Beta<void, void>' to 'Alpha<int, int>' for 1st argument
135 
136 void set5(Alpha<Beta<Gamma<Delta<int, int>, int>, int>, int>);
test5()137 void test5() {
138   set5(Alpha<Beta<Gamma<void, void>, double>, double>());
139 }
140 // CHECK-ELIDE-NOTREE: no matching function for call to 'set5'
141 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'Alpha<Beta<Gamma<void, void>, double>, double>' to 'Alpha<Beta<Gamma<Delta<int, int>, int>, int>, int>' for 1st argument
142 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set5'
143 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'Alpha<Beta<Gamma<void, void>, double>, double>' to 'Alpha<Beta<Gamma<Delta<int, int>, int>, int>, int>' for 1st argument
144 // CHECK-ELIDE-TREE: no matching function for call to 'set5'
145 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
146 // CHECK-ELIDE-TREE:   Alpha<
147 // CHECK-ELIDE-TREE:     Beta<
148 // CHECK-ELIDE-TREE:       Gamma<
149 // CHECK-ELIDE-TREE:         [void != Delta<int, int>],
150 // CHECK-ELIDE-TREE:         [void != int]>
151 // CHECK-ELIDE-TREE:       [double != int]>
152 // CHECK-ELIDE-TREE:     [double != int]>
153 // CHECK-NOELIDE-TREE: no matching function for call to 'set5'
154 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
155 // CHECK-NOELIDE-TREE:   Alpha<
156 // CHECK-NOELIDE-TREE:     Beta<
157 // CHECK-NOELIDE-TREE:       Gamma<
158 // CHECK-NOELIDE-TREE:         [void != Delta<int, int>],
159 // CHECK-NOELIDE-TREE:         [void != int]>
160 // CHECK-NOELIDE-TREE:       [double != int]>
161 // CHECK-NOELIDE-TREE:     [double != int]>
162 
test6()163 void test6() {
164   set5(Alpha<Beta<Delta<int, int>, int>, int>());
165 }
166 // CHECK-ELIDE-NOTREE: no matching function for call to 'set5'
167 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'Alpha<Beta<Delta<int, int>, [...]>, [...]>' to 'Alpha<Beta<Gamma<Delta<int, int>, int>, [...]>, [...]>' for 1st argument
168 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set5'
169 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'Alpha<Beta<Delta<int, int>, int>, int>' to 'Alpha<Beta<Gamma<Delta<int, int>, int>, int>, int>' for 1st argument
170 // CHECK-ELIDE-TREE: no matching function for call to 'set5'
171 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
172 // CHECK-ELIDE-TREE:   Alpha<
173 // CHECK-ELIDE-TREE:     Beta<
174 // CHECK-ELIDE-TREE:       [Delta<int, int> != Gamma<Delta<int, int>, int>],
175 // CHECK-ELIDE-TREE:       [...]>
176 // CHECK-ELIDE-TREE:     [...]>
177 // CHECK-NOELIDE-TREE: no matching function for call to 'set5'
178 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
179 // CHECK-NOELIDE-TREE:   Alpha<
180 // CHECK-NOELIDE-TREE:     Beta<
181 // CHECK-NOELIDE-TREE:       [Delta<int, int> != Gamma<Delta<int, int>, int>],
182 // CHECK-NOELIDE-TREE:       int>
183 // CHECK-NOELIDE-TREE:     int>
184 
185 int a7, b7;
186 int c7[] = {1,2,3};
187 template<int *A>
188 class class7 {};
set7(class7<& a7> A)189 void set7(class7<&a7> A) {}
test7()190 void test7() {
191   set7(class7<&a7>());
192   set7(class7<&b7>());
193   set7(class7<c7>());
194   set7(class7<nullptr>());
195 }
196 // CHECK-ELIDE-NOTREE: no matching function for call to 'set7'
197 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class7<&b7>' to 'class7<&a7>' for 1st argument
198 // CHECK-ELIDE-NOTREE: no matching function for call to 'set7'
199 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class7<c7>' to 'class7<&a7>' for 1st argument
200 // CHECK-ELIDE-NOTREE: no matching function for call to 'set7'
201 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class7<nullptr>' to 'class7<&a7>' for 1st argument
202 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set7'
203 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class7<&b7>' to 'class7<&a7>' for 1st argument
204 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set7'
205 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class7<c7>' to 'class7<&a7>' for 1st argument
206 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set7'
207 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class7<nullptr>' to 'class7<&a7>' for 1st argument
208 // CHECK-ELIDE-TREE: no matching function for call to 'set7'
209 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
210 // CHECK-ELIDE-TREE:   class7<
211 // CHECK-ELIDE-TREE:     [&b7 != &a7]>
212 // CHECK-ELIDE-TREE: no matching function for call to 'set7'
213 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
214 // CHECK-ELIDE-TREE:   class7<
215 // CHECK-ELIDE-TREE:     [c7 != &a7]>
216 // CHECK-ELIDE-TREE: no matching function for call to 'set7'
217 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
218 // CHECK-ELIDE-TREE:   class7<
219 // CHECK-ELIDE-TREE:     [nullptr != &a7]>
220 // CHECK-NOELIDE-TREE: no matching function for call to 'set7'
221 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
222 // CHECK-NOELIDE-TREE:   class7<
223 // CHECK-NOELIDE-TREE:     [&b7 != &a7]>
224 // CHECK-NOELIDE-TREE: no matching function for call to 'set7'
225 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
226 // CHECK-NOELIDE-TREE:   class7<
227 // CHECK-NOELIDE-TREE:     [c7 != &a7]>
228 // CHECK-NOELIDE-TREE: no matching function for call to 'set7'
229 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
230 // CHECK-NOELIDE-TREE:   class7<
231 // CHECK-NOELIDE-TREE:     [nullptr != &a7]>
232 
233 template<typename ...T> struct S8 {};
234 template<typename T> using U8 = S8<int, char, T>;
235 int f8(S8<int, char, double>);
236 int k8 = f8(U8<char>());
237 // CHECK-ELIDE-NOTREE: no matching function for call to 'f8'
238 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'S8<[2 * ...], char>' to 'S8<[2 * ...], double>' for 1st argument
239 // CHECK-NOELIDE-NOTREE: no matching function for call to 'f8'
240 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'S8<int, char, char>' to 'S8<int, char, double>' for 1st argument
241 // CHECK-ELIDE-TREE: no matching function for call to 'f8'
242 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
243 // CHECK-ELIDE-TREE:   S8<
244 // CHECK-ELIDE-TREE:     [2 * ...],
245 // CHECK-ELIDE-TREE:     [char != double]>
246 // CHECK-NOELIDE-TREE: no matching function for call to 'f8'
247 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
248 // CHECK-NOELIDE-TREE:   S8<
249 // CHECK-NOELIDE-TREE:     int,
250 // CHECK-NOELIDE-TREE:     char,
251 // CHECK-NOELIDE-TREE:     [char != double]>
252 
253 template<typename ...T> struct S9 {};
254 template<typename T> using U9 = S9<int, char, T>;
255 template<typename T> using V9 = U9<U9<T>>;
256 int f9(S9<int, char, U9<const double>>);
257 int k9 = f9(V9<double>());
258 
259 // CHECK-ELIDE-NOTREE: no matching function for call to 'f9'
260 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'S9<[2 * ...], S9<[2 * ...], double>>' to 'S9<[2 * ...], S9<[2 * ...], const double>>' for 1st argument
261 // CHECK-NOELIDE-NOTREE: no matching function for call to 'f9'
262 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'S9<int, char, S9<int, char, double>>' to 'S9<int, char, S9<int, char, const double>>' for 1st argument
263 // CHECK-ELIDE-TREE: no matching function for call to 'f9'
264 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
265 // CHECK-ELIDE-TREE:   S9<
266 // CHECK-ELIDE-TREE:     [2 * ...],
267 // CHECK-ELIDE-TREE:     S9<
268 // CHECK-ELIDE-TREE:       [2 * ...],
269 // CHECK-ELIDE-TREE:       [double != const double]>>
270 // CHECK-NOELIDE-TREE: no matching function for call to 'f9'
271 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
272 // CHECK-NOELIDE-TREE:   S9<
273 // CHECK-NOELIDE-TREE:     int,
274 // CHECK-NOELIDE-TREE:     char,
275 // CHECK-NOELIDE-TREE:     S9<
276 // CHECK-NOELIDE-TREE:       int,
277 // CHECK-NOELIDE-TREE:       char,
278 // CHECK-NOELIDE-TREE:       [double != const double]>>
279 
280 template<typename ...A> class class_types {};
set10(class_types<int,int>)281 void set10(class_types<int, int>) {}
test10()282 void test10() {
283   set10(class_types<int>());
284   set10(class_types<int, int, int>());
285 }
286 
287 // CHECK-ELIDE-NOTREE: no matching function for call to 'set10'
288 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class_types<[...], (no argument)>' to 'class_types<[...], int>' for 1st argument
289 // CHECK-ELIDE-NOTREE: no matching function for call to 'set10'
290 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class_types<[2 * ...], int>' to 'class_types<[2 * ...], (no argument)>' for 1st argument
291 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set10'
292 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class_types<int, (no argument)>' to 'class_types<int, int>' for 1st argument
293 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set10'
294 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class_types<int, int, int>' to 'class_types<int, int, (no argument)>' for 1st argument
295 // CHECK-ELIDE-TREE: no matching function for call to 'set10'
296 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
297 // CHECK-ELIDE-TREE:   class_types<
298 // CHECK-ELIDE-TREE:     [...],
299 // CHECK-ELIDE-TREE:     [(no argument) != int]>
300 // CHECK-ELIDE-TREE: no matching function for call to 'set10'
301 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
302 // CHECK-ELIDE-TREE:   class_types<
303 // CHECK-ELIDE-TREE:     [2 * ...],
304 // CHECK-ELIDE-TREE:     [int != (no argument)]>
305 // CHECK-NOELIDE-TREE: no matching function for call to 'set10'
306 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
307 // CHECK-NOELIDE-TREE:   class_types<
308 // CHECK-NOELIDE-TREE:     int,
309 // CHECK-NOELIDE-TREE:     [(no argument) != int]>
310 // CHECK-NOELIDE-TREE: no matching function for call to 'set10'
311 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
312 // CHECK-NOELIDE-TREE:   class_types<
313 // CHECK-NOELIDE-TREE:     int,
314 // CHECK-NOELIDE-TREE:     int,
315 // CHECK-NOELIDE-TREE:     [int != (no argument)]>
316 
317 template<int ...A> class class_ints {};
set11(class_ints<2,3>)318 void set11(class_ints<2, 3>) {}
test11()319 void test11() {
320   set11(class_ints<1>());
321   set11(class_ints<0, 3, 6>());
322 }
323 // CHECK-ELIDE-NOTREE: no matching function for call to 'set11'
324 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class_ints<1, (no argument)>' to 'class_ints<2, 3>' for 1st argument
325 // CHECK-ELIDE-NOTREE: no matching function for call to 'set11'
326 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class_ints<0, [...], 6>' to 'class_ints<2, [...], (no argument)>' for 1st argument
327 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set11'
328 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class_ints<1, (no argument)>' to 'class_ints<2, 3>' for 1st argument
329 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set11'
330 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class_ints<0, 3, 6>' to 'class_ints<2, 3, (no argument)>' for 1st argument
331 // CHECK-ELIDE-TREE: no matching function for call to 'set11'
332 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
333 // CHECK-ELIDE-TREE:   class_ints<
334 // CHECK-ELIDE-TREE:     [1 != 2],
335 // CHECK-ELIDE-TREE:     [(no argument) != 3]>
336 // CHECK-ELIDE-TREE: no matching function for call to 'set11'
337 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
338 // CHECK-ELIDE-TREE:   class_ints<
339 // CHECK-ELIDE-TREE:     [0 != 2],
340 // CHECK-ELIDE-TREE:     [...],
341 // CHECK-ELIDE-TREE:     [6 != (no argument)]>
342 // CHECK-NOELIDE-TREE: no matching function for call to 'set11'
343 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
344 // CHECK-NOELIDE-TREE:   class_ints<
345 // CHECK-NOELIDE-TREE:     [1 != 2],
346 // CHECK-NOELIDE-TREE:     [(no argument) != 3]>
347 // CHECK-NOELIDE-TREE: no matching function for call to 'set11'
348 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
349 // CHECK-NOELIDE-TREE:   class_ints<
350 // CHECK-NOELIDE-TREE:     [0 != 2],
351 // CHECK-NOELIDE-TREE:     3,
352 // CHECK-NOELIDE-TREE:     [6 != (no argument)]>
353 
354 template<template<class> class ...A> class class_template_templates {};
355 template<class> class tt1 {};
356 template<class> class tt2 {};
set12(class_template_templates<tt1,tt1>)357 void set12(class_template_templates<tt1, tt1>) {}
test12()358 void test12() {
359   set12(class_template_templates<tt2>());
360   set12(class_template_templates<tt1, tt1, tt1>());
361 }
362 // CHECK-ELIDE-NOTREE: no matching function for call to 'set12'
363 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class_template_templates<template tt2, template (no argument)>' to 'class_template_templates<template tt1, template tt1>' for 1st argument
364 // CHECK-ELIDE-NOTREE: no matching function for call to 'set12'
365 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class_template_templates<[2 * ...], template tt1>' to 'class_template_templates<[2 * ...], template (no argument)>' for 1st argument
366 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set12'
367 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class_template_templates<template tt2, template (no argument)>' to 'class_template_templates<template tt1, template tt1>' for 1st argument
368 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set12'
369 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class_template_templates<template tt1, template tt1, template tt1>' to 'class_template_templates<template tt1, template tt1, template (no argument)>' for 1st argument
370 // CHECK-ELIDE-TREE: no matching function for call to 'set12'
371 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
372 // CHECK-ELIDE-TREE:   class_template_templates<
373 // CHECK-ELIDE-TREE:     [template tt2 != template tt1],
374 // CHECK-ELIDE-TREE:     [template (no argument) != template tt1]>
375 // CHECK-ELIDE-TREE: no matching function for call to 'set12'
376 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
377 // CHECK-ELIDE-TREE:   class_template_templates<
378 // CHECK-ELIDE-TREE:     [2 * ...],
379 // CHECK-ELIDE-TREE:     [template tt1 != template (no argument)]>
380 // CHECK-NOELIDE-TREE: no matching function for call to 'set12'
381 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
382 // CHECK-NOELIDE-TREE:   class_template_templates<
383 // CHECK-NOELIDE-TREE:     [template tt2 != template tt1],
384 // CHECK-NOELIDE-TREE:     [template (no argument) != template tt1]>
385 // CHECK-NOELIDE-TREE: no matching function for call to 'set12'
386 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
387 // CHECK-NOELIDE-TREE:   class_template_templates<
388 // CHECK-NOELIDE-TREE:     template tt1,
389 // CHECK-NOELIDE-TREE:     template tt1,
390 // CHECK-NOELIDE-TREE:     [template tt1 != template (no argument)]>
391 
392 double a13, b13, c13, d13;
393 template<double* ...A> class class_ptrs {};
set13(class_ptrs<& a13,& b13>)394 void set13(class_ptrs<&a13, &b13>) {}
test13()395 void test13() {
396   set13(class_ptrs<&c13>());
397   set13(class_ptrss<&a13, &b13, &d13>());
398 }
399 // CHECK-ELIDE-NOTREE: no matching function for call to 'set13'
400 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class_ptrs<&c13, (no argument)>' to 'class_ptrs<&a13, &b13>' for 1st argument
401 // CHECK-ELIDE-NOTREE: no matching function for call to 'set13'
402 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class_ptrs<[2 * ...], &d13>' to 'class_ptrs<[2 * ...], (no argument)>' for 1st argument
403 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set13'
404 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class_ptrs<&c13, (no argument)>' to 'class_ptrs<&a13, &b13>' for 1st argument
405 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set13'
406 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class_ptrs<&a13, &b13, &d13>' to 'class_ptrs<&a13, &b13, (no argument)>' for 1st argument
407 // CHECK-ELIDE-TREE: no matching function for call to 'set13'
408 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
409 // CHECK-ELIDE-TREE:   class_ptrs<
410 // CHECK-ELIDE-TREE:     [&c13 != &a13],
411 // CHECK-ELIDE-TREE:     [(no argument) != &b13]>
412 // CHECK-ELIDE-TREE: no matching function for call to 'set13'
413 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
414 // CHECK-ELIDE-TREE:   class_ptrs<
415 // CHECK-ELIDE-TREE:     [2 * ...],
416 // CHECK-ELIDE-TREE:     [&d13 != (no argument)]>
417 // CHECK-NOELIDE-TREE: no matching function for call to 'set13'
418 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
419 // CHECK-NOELIDE-TREE:   class_ptrs<
420 // CHECK-NOELIDE-TREE:     [&c13 != &a13],
421 // CHECK-NOELIDE-TREE:     [(no argument) != &b13]>
422 // CHECK-NOELIDE-TREE: no matching function for call to 'set13'
423 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
424 // CHECK-NOELIDE-TREE:   class_ptrs<
425 // CHECK-NOELIDE-TREE:     &a13,
426 // CHECK-NOELIDE-TREE:     &b13,
427 // CHECK-NOELIDE-TREE:     [&d13 != (no argument)]>
428 
429 template<typename T> struct s14 {};
430 template<typename T> using a14 = s14<T>;
431 typedef a14<int> b14;
432 template<typename T> using c14 = b14;
433 int f14(c14<int>);
434 int k14 = f14(a14<char>());
435 // CHECK-ELIDE-NOTREE: no matching function for call to 'f14'
436 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'a14<char>' to 'a14<int>' for 1st argument
437 // CHECK-NOELIDE-NOTREE: no matching function for call to 'f14'
438 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'a14<char>' to 'a14<int>' for 1st argument
439 // CHECK-ELIDE-TREE: no matching function for call to 'f14'
440 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
441 // CHECK-ELIDE-TREE:   a14<
442 // CHECK-ELIDE-TREE:     [char != int]>
443 // CHECK-NOELIDE-TREE: no matching function for call to 'f14'
444 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
445 // CHECK-NOELIDE-TREE:   a14<
446 // CHECK-NOELIDE-TREE:     [char != int]>
447 
set15(vector<vector<int>>)448 void set15(vector<vector<int>>) {}
test15()449 void test15() {
450   set15(vector<vector<int>>());
451 }
452 // CHECK-ELIDE-NOTREE-NOT: set15
453 // CHECK-NOELIDE-NOTREE-NOT: set15
454 // CHECK-ELIDE-TREE-NOT: set15
455 // CHECK-NOELIDE-TREE-NOT: set15
456 // no error here
457 
set16(vector<const vector<int>>)458 void set16(vector<const vector<int>>) {}
test16()459 void test16() {
460   set16(vector<const vector<const int>>());
461 }
462 // CHECK-ELIDE-NOTREE: no matching function for call to 'set16'
463 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<const vector<const int>>' to 'vector<const vector<int>>' for 1st argument
464 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set16'
465 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<const vector<const int>>' to 'vector<const vector<int>>' for 1st argument
466 // CHECK-ELIDE-TREE: no matching function for call to 'set16'
467 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
468 // CHECK-ELIDE-TREE:   vector<
469 // CHECK-ELIDE-TREE:     const vector<
470 // CHECK-ELIDE-TREE:       [const != (no qualifiers)] int>>
471 // CHECK-NOELIDE-TREE: no matching function for call to 'set16'
472 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
473 // CHECK-NOELIDE-TREE:   vector<
474 // CHECK-NOELIDE-TREE:     const vector<
475 // CHECK-NOELIDE-TREE:       [const != (no qualifiers)] int>>
476 
set17(vector<vector<int>>)477 void set17(vector<vector<int>>) {}
test17()478 void test17() {
479   set17(vector<const vector<int>>());
480 }
481 // CHECK-ELIDE-NOTREE: no matching function for call to 'set17'
482 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<const vector<[...]>>' to 'vector<vector<[...]>>' for 1st argument
483 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set17'
484 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<const vector<int>>' to 'vector<vector<int>>' for 1st argument
485 // CHECK-ELIDE-TREE: no matching function for call to 'set17'
486 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
487 // CHECK-ELIDE-TREE:   vector<
488 // CHECK-ELIDE-TREE:     [const != (no qualifiers)] vector<
489 // CHECK-ELIDE-TREE:       [...]>>
490 // CHECK-NOELIDE-TREE: no matching function for call to 'set17'
491 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
492 // CHECK-NOELIDE-TREE:   vector<
493 // CHECK-NOELIDE-TREE:     [const != (no qualifiers)] vector<
494 // CHECK-NOELIDE-TREE:       int>>
495 
set18(vector<const vector<int>>)496 void set18(vector<const vector<int>>) {}
test18()497 void test18() {
498   set18(vector<vector<int>>());
499 }
500 // CHECK-ELIDE-NOTREE: no matching function for call to 'set18'
501 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<vector<[...]>>' to 'vector<const vector<[...]>>' for 1st argument
502 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set18'
503 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<vector<int>>' to 'vector<const vector<int>>' for 1st argument
504 // CHECK-ELIDE-TREE: no matching function for call to 'set18'
505 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
506 // CHECK-ELIDE-TREE:   vector<
507 // CHECK-ELIDE-TREE:     [(no qualifiers) != const] vector<
508 // CHECK-ELIDE-TREE:       [...]>>
509 // CHECK-NOELIDE-TREE: no matching function for call to 'set18'
510 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
511 // CHECK-NOELIDE-TREE:   vector<
512 // CHECK-NOELIDE-TREE:     [(no qualifiers) != const] vector<
513 // CHECK-NOELIDE-TREE:       int>>
514 
set19(vector<volatile vector<int>>)515 void set19(vector<volatile vector<int>>) {}
test19()516 void test19() {
517   set19(vector<const vector<int>>());
518 }
519 // CHECK-ELIDE-NOTREE: no matching function for call to 'set19'
520 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<const vector<[...]>>' to 'vector<volatile vector<[...]>>' for 1st argument
521 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set19'
522 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<const vector<int>>' to 'vector<volatile vector<int>>' for 1st argument
523 // CHECK-ELIDE-TREE: no matching function for call to 'set19'
524 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
525 // CHECK-ELIDE-TREE:   vector<
526 // CHECK-ELIDE-TREE:     [const != volatile] vector<
527 // CHECK-ELIDE-TREE:       [...]>>
528 // CHECK-NOELIDE-TREE: no matching function for call to 'set19'
529 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
530 // CHECK-NOELIDE-TREE:   vector<
531 // CHECK-NOELIDE-TREE:     [const != volatile] vector<
532 // CHECK-NOELIDE-TREE:       int>>
533 
set20(vector<const volatile vector<int>>)534 void set20(vector<const volatile vector<int>>) {}
test20()535 void test20() {
536   set20(vector<const vector<int>>());
537 }
538 // CHECK-ELIDE-NOTREE: no matching function for call to 'set20'
539 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<const vector<[...]>>' to 'vector<const volatile vector<[...]>>' for 1st argument
540 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set20'
541 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<const vector<int>>' to 'vector<const volatile vector<int>>' for 1st argument
542 // CHECK-ELIDE-TREE: no matching function for call to 'set20'
543 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
544 // CHECK-ELIDE-TREE:   vector<
545 // CHECK-ELIDE-TREE:     [const != const volatile] vector<
546 // CHECK-ELIDE-TREE:       [...]>>
547 // CHECK-NOELIDE-TREE: no matching function for call to 'set20'
548 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
549 // CHECK-NOELIDE-TREE:   vector<
550 // CHECK-NOELIDE-TREE:     [const != const volatile] vector<
551 // CHECK-NOELIDE-TREE:       int>>
552 
553 
554 // Checks that volatile does not show up in diagnostics.
555 template<typename T> struct S21 {};
556 template<typename T> using U21 = volatile S21<T>;
557 int f21(vector<const U21<int>>);
558 int k21 = f21(vector<U21<int>>());
559 // CHECK-ELIDE-NOTREE: no matching function for call to 'f21'
560 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<U21<[...]>>' to 'vector<const U21<[...]>>' for 1st argument
561 // CHECK-NOELIDE-NOTREE: no matching function for call to 'f21'
562 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<U21<int>>' to 'vector<const U21<int>>' for 1st argument
563 // CHECK-ELIDE-TREE: no matching function for call to 'f21'
564 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
565 // CHECK-ELIDE-TREE:    vector<
566 // CHECK-ELIDE-TREE:      [(no qualifiers) != const] U21<
567 // CHECK-ELIDE-TREE:        [...]>>
568 // CHECK-NOELIDE-TREE: no matching function for call to 'f21'
569 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
570 // CHECK-NOELIDE-TREE:    vector<
571 // CHECK-NOELIDE-TREE:      [(no qualifiers) != const] U21<
572 // CHECK-NOELIDE-TREE:        int>>
573 
574 // Checks that volatile does not show up in diagnostics.
575 template<typename T> struct S22 {};
576 template<typename T> using U22 = volatile S22<T>;
577 int f22(vector<volatile const U22<int>>);
578 int k22 = f22(vector<volatile U22<int>>());
579 // CHECK-ELIDE-NOTREE: no matching function for call to 'f22'
580 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<U22<[...]>>' to 'vector<const U22<[...]>>' for 1st argument
581 // CHECK-NOELIDE-NOTREE: no matching function for call to 'f22'
582 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<U22<int>>' to 'vector<const U22<int>>' for 1st argument
583 // CHECK-ELIDE-TREE: no matching function for call to 'f22'
584 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
585 // CHECK-ELIDE-TREE:    vector<
586 // CHECK-ELIDE-TREE:      [(no qualifiers) != const] U22<
587 // CHECK-ELIDE-TREE:        [...]>>
588 // CHECK-NOELIDE-TREE: no matching function for call to 'f22'
589 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
590 // CHECK-NOELIDE-TREE:    vector<
591 // CHECK-NOELIDE-TREE:      [(no qualifiers) != const] U22<
592 // CHECK-NOELIDE-TREE:        int>>
593 
594 // Testing qualifiers and typedefs.
595 template <class T> struct D23{};
596 template <class T> using C23 = D23<T>;
597 typedef const C23<int> B23;
598 template<class ...T> using A23 = B23;
599 
foo23(D23<A23<>> b)600 void foo23(D23<A23<>> b) {}
test23()601 void test23() {
602   foo23(D23<D23<char>>());
603   foo23(C23<char>());
604 }
605 
606 // CHECK-ELIDE-NOTREE: no matching function for call to 'foo23'
607 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'D23<D23<char>>' to 'D23<const D23<int>>' for 1st argument
608 // CHECK-ELIDE-NOTREE: no matching function for call to 'foo23'
609 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'D23<char>' to 'D23<A23<>>' for 1st argument
610 // CHECK-NOELIDE-NOTREE: no matching function for call to 'foo23'
611 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'D23<D23<char>>' to 'D23<const D23<int>>' for 1st argument
612 // CHECK-NOELIDE-NOTREE: no matching function for call to 'foo23'
613 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'D23<char>' to 'D23<A23<>>' for 1st argument
614 // CHECK-ELIDE-TREE: no matching function for call to 'foo23'
615 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
616 // CHECK-ELIDE-TREE:   D23<
617 // CHECK-ELIDE-TREE:     [(no qualifiers) != const] D23<
618 // CHECK-ELIDE-TREE:       [char != int]>>
619 // CHECK-ELIDE-TREE: no matching function for call to 'foo23'
620 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
621 // CHECK-ELIDE-TREE:   D23<
622 // CHECK-ELIDE-TREE:     [char != A23<>]>
623 // CHECK-NOELIDE-TREE: no matching function for call to 'foo23'
624 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
625 // CHECK-NOELIDE-TREE:   D23<
626 // CHECK-NOELIDE-TREE:     [(no qualifiers) != const] D23<
627 // CHECK-NOELIDE-TREE:       [char != int]>>
628 // CHECK-NOELIDE-TREE: no matching function for call to 'foo23'
629 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
630 // CHECK-NOELIDE-TREE:   D23<
631 // CHECK-NOELIDE-TREE:     [char != A23<>]>
632 
633 namespace PR14015 {
634 template <unsigned N> class Foo1 {};
635 template <unsigned N = 2> class Foo2 {};
636 template <unsigned ...N> class Foo3 {};
637 
Play1()638 void Play1() {
639   Foo1<1> F1;
640   Foo1<2> F2, F3;
641   F2 = F1;
642   F1 = F2;
643   F2 = F3;
644   F3 = F2;
645 }
646 
647 // CHECK-ELIDE-NOTREE: no viable overloaded '='
648 // CHECK-ELIDE-NOTREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from 'Foo1<1>' to 'Foo1<2>' for 1st argument
649 // CHECK-ELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo1<1>' to 'Foo1<2>' for 1st argument
650 // CHECK-ELIDE-NOTREE: no viable overloaded '='
651 // CHECK-ELIDE-NOTREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from 'Foo1<2>' to 'Foo1<1>' for 1st argument
652 // CHECK-ELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo1<2>' to 'Foo1<1>' for 1st argument
653 // CHECK-NOELIDE-NOTREE: no viable overloaded '='
654 // CHECK-NOELIDE-NOTREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from 'Foo1<1>' to 'Foo1<2>' for 1st argument
655 // CHECK-NOELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo1<1>' to 'Foo1<2>' for 1st argument
656 // CHECK-NOELIDE-NOTREE: no viable overloaded '='
657 // CHECK-NOELIDE-NOTREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from 'Foo1<2>' to 'Foo1<1>' for 1st argument
658 // CHECK-NOELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo1<2>' to 'Foo1<1>' for 1st argument
659 // CHECK-ELIDE-TREE: no viable overloaded '='
660 // CHECK-ELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
661 // CHECK-ELIDE-TREE:   Foo1<
662 // CHECK-ELIDE-TREE:     [1 != 2]>
663 // CHECK-ELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
664 // CHECK-ELIDE-TREE:   Foo1<
665 // CHECK-ELIDE-TREE:     [1 != 2]>
666 // CHECK-ELIDE-TREE: no viable overloaded '='
667 // CHECK-ELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
668 // CHECK-ELIDE-TREE:   Foo1<
669 // CHECK-ELIDE-TREE:     [2 != 1]>
670 // CHECK-ELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
671 // CHECK-ELIDE-TREE:   Foo1<
672 // CHECK-ELIDE-TREE:     [2 != 1]>
673 // CHECK-NOELIDE-TREE: no viable overloaded '='
674 // CHECK-NOELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
675 // CHECK-NOELIDE-TREE:   Foo1<
676 // CHECK-NOELIDE-TREE:     [1 != 2]>
677 // CHECK-NOELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
678 // CHECK-NOELIDE-TREE:   Foo1<
679 // CHECK-NOELIDE-TREE:     [1 != 2]>
680 // CHECK-NOELIDE-TREE: no viable overloaded '='
681 // CHECK-NOELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
682 // CHECK-NOELIDE-TREE:   Foo1<
683 // CHECK-NOELIDE-TREE:     [2 != 1]>
684 // CHECK-NOELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
685 // CHECK-NOELIDE-TREE:   Foo1<
686 // CHECK-NOELIDE-TREE:     [2 != 1]>
687 
Play2()688 void Play2() {
689   Foo2<1> F1;
690   Foo2<> F2, F3;
691   F2 = F1;
692   F1 = F2;
693   F2 = F3;
694   F3 = F2;
695 }
696 // CHECK-ELIDE-NOTREE: no viable overloaded '='
697 // CHECK-ELIDE-NOTREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from 'Foo2<1>' to 'Foo2<2>' for 1st argument
698 // CHECK-ELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo2<1>' to 'Foo2<2>' for 1st argument
699 // CHECK-ELIDE-NOTREE: no viable overloaded '='
700 // CHECK-ELIDE-NOTREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from 'Foo2<(default) 2>' to 'Foo2<1>' for 1st argument
701 // CHECK-ELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo2<(default) 2>' to 'Foo2<1>' for 1st argument
702 // CHECK-NOELIDE-NOTREE: no viable overloaded '='
703 // CHECK-NOELIDE-NOTREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from 'Foo2<1>' to 'Foo2<2>' for 1st argument
704 // CHECK-NOELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo2<1>' to 'Foo2<2>' for 1st argument
705 // CHECK-NOELIDE-NOTREE: no viable overloaded '='
706 // CHECK-NOELIDE-NOTREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from 'Foo2<(default) 2>' to 'Foo2<1>' for 1st argument
707 // CHECK-NOELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo2<(default) 2>' to 'Foo2<1>' for 1st argument
708 // CHECK-ELIDE-TREE: no viable overloaded '='
709 // CHECK-ELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
710 // CHECK-ELIDE-TREE:   Foo2<
711 // CHECK-ELIDE-TREE:     [1 != 2]>
712 // CHECK-ELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
713 // CHECK-ELIDE-TREE:   Foo2<
714 // CHECK-ELIDE-TREE:     [1 != 2]>
715 // CHECK-ELIDE-TREE: no viable overloaded '='
716 // CHECK-ELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
717 // CHECK-ELIDE-TREE:   Foo2<
718 // CHECK-ELIDE-TREE:     [(default) 2 != 1]>
719 // CHECK-ELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
720 // CHECK-ELIDE-TREE:   Foo2<
721 // CHECK-ELIDE-TREE:     [(default) 2 != 1]>
722 // CHECK-NOELIDE-TREE: no viable overloaded '='
723 // CHECK-NOELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
724 // CHECK-NOELIDE-TREE:   Foo2<
725 // CHECK-NOELIDE-TREE:     [1 != 2]>
726 // CHECK-NOELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
727 // CHECK-NOELIDE-TREE:   Foo2<
728 // CHECK-NOELIDE-TREE:     [1 != 2]>
729 // CHECK-NOELIDE-TREE: no viable overloaded '='
730 // CHECK-NOELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
731 // CHECK-NOELIDE-TREE:   Foo2<
732 // CHECK-NOELIDE-TREE:     [(default) 2 != 1]>
733 // CHECK-NOELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
734 // CHECK-NOELIDE-TREE:   Foo2<
735 // CHECK-NOELIDE-TREE:     [(default) 2 != 1]>
736 
Play3()737 void Play3() {
738   Foo3<1> F1;
739   Foo3<2, 1> F2, F3;
740   F2 = F1;
741   F1 = F2;
742   F2 = F3;
743   F3 = F2;
744 }
745 // CHECK-ELIDE-NOTREE: no viable overloaded '='
746 // CHECK-ELIDE-NOTREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from 'Foo3<1, (no argument)>' to 'Foo3<2, 1>' for 1st argument
747 // CHECK-ELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo3<1, (no argument)>' to 'Foo3<2, 1>' for 1st argument
748 // CHECK-ELIDE-NOTREE: no viable overloaded '='
749 // CHECK-ELIDE-NOTREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from 'Foo3<2, 1>' to 'Foo3<1, (no argument)>' for 1st argument
750 // CHECK-ELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo3<2, 1>' to 'Foo3<1, (no argument)>' for 1st argument
751 // CHECK-NOELIDE-NOTREE: no viable overloaded '='
752 // CHECK-NOELIDE-NOTREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from 'Foo3<1, (no argument)>' to 'Foo3<2, 1>' for 1st argument
753 // CHECK-NOELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo3<1, (no argument)>' to 'Foo3<2, 1>' for 1st argument
754 // CHECK-NOELIDE-NOTREE: no viable overloaded '='
755 // CHECK-NOELIDE-NOTREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from 'Foo3<2, 1>' to 'Foo3<1, (no argument)>' for 1st argument
756 // CHECK-NOELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo3<2, 1>' to 'Foo3<1, (no argument)>' for 1st argument
757 // CHECK-ELIDE-TREE: no viable overloaded '='
758 // CHECK-ELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
759 // CHECK-ELIDE-TREE:   Foo3<
760 // CHECK-ELIDE-TREE:     [1 != 2],
761 // CHECK-ELIDE-TREE:     [(no argument) != 1]>
762 // CHECK-ELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
763 // CHECK-ELIDE-TREE:   Foo3<
764 // CHECK-ELIDE-TREE:     [1 != 2],
765 // CHECK-ELIDE-TREE:     [(no argument) != 1]>
766 // CHECK-ELIDE-TREE: no viable overloaded '='
767 // CHECK-ELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
768 // CHECK-ELIDE-TREE:   Foo3<
769 // CHECK-ELIDE-TREE:     [2 != 1],
770 // CHECK-ELIDE-TREE:     [1 != (no argument)]>
771 // CHECK-ELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
772 // CHECK-ELIDE-TREE:   Foo3<
773 // CHECK-ELIDE-TREE:     [2 != 1],
774 // CHECK-ELIDE-TREE:     [1 != (no argument)]>
775 // CHECK-NOELIDE-TREE: no viable overloaded '='
776 // CHECK-NOELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
777 // CHECK-NOELIDE-TREE:   Foo3<
778 // CHECK-NOELIDE-TREE:     [1 != 2],
779 // CHECK-NOELIDE-TREE:     [(no argument) != 1]>
780 // CHECK-NOELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
781 // CHECK-NOELIDE-TREE:   Foo3<
782 // CHECK-NOELIDE-TREE:     [1 != 2],
783 // CHECK-NOELIDE-TREE:     [(no argument) != 1]>
784 // CHECK-NOELIDE-TREE: no viable overloaded '='
785 // CHECK-NOELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
786 // CHECK-NOELIDE-TREE:   Foo3<
787 // CHECK-NOELIDE-TREE:     [2 != 1],
788 // CHECK-NOELIDE-TREE:     [1 != (no argument)]>
789 // CHECK-NOELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
790 // CHECK-NOELIDE-TREE:   Foo3<
791 // CHECK-NOELIDE-TREE:     [2 != 1],
792 // CHECK-NOELIDE-TREE:     [1 != (no argument)]>
793 }
794 
795 namespace PR14342 {
796   template<typename T, short a> struct X {};
797   X<int, (signed char)-1> x = X<long, -1>();
798   X<int, 3UL> y = X<int, 2>();
799   // CHECK-ELIDE-NOTREE: error: no viable conversion from 'X<long, [...]>' to 'X<int, [...]>'
800   // CHECK-ELIDE-NOTREE: error: no viable conversion from 'X<[...], 2>' to 'X<[...], 3>'
801 }
802 
803 namespace PR14489 {
804   // The important thing here is that the diagnostic diffs a template specialization
805   // with no arguments against itself.  (We might need a different test if this
806   // diagnostic changes).
807   template<class ...V>
808   struct VariableList   {
ConnectAllToAllPR14489::VariableList809     void ConnectAllToAll(VariableList<>& params = VariableList<>())    {
810     }
811   };
812   // CHECK-ELIDE-NOTREE: non-const lvalue reference to type 'VariableList<>' cannot bind to a temporary of type 'VariableList<>'
813 }
814 
815 namespace rdar12456626 {
816   struct IntWrapper {
817     typedef int type;
818   };
819 
820   template<typename T, typename T::type V>
821   struct X { };
822 
823   struct A {
824     virtual X<IntWrapper, 1> foo();
825   };
826 
827   struct B : A {
828     // CHECK-ELIDE-NOTREE: virtual function 'foo' has a different return type
829     virtual X<IntWrapper, 2> foo();
830   };
831 }
832 
833 namespace PR15023 {
834   // Don't crash when non-QualTypes are passed to a diff modifier.
835   template <typename... Args>
func(void (* func)(Args...),Args...)836   void func(void (*func)(Args...), Args...) { }
837 
bar(int,int &)838   void bar(int, int &) {
839   }
840 
foo(int x)841   void foo(int x) {
842     func(bar, 1, x)
843   }
844   // CHECK-ELIDE-NOTREE: no matching function for call to 'func'
845   // CHECK-ELIDE-NOTREE: candidate template ignored: deduced conflicting types for parameter 'Args' (<int, int &> vs. <int, int>)
846 }
847 
848 namespace rdar12931988 {
849   namespace A {
850     template<typename T> struct X { };
851   }
852 
853   namespace B {
854     template<typename T> struct X { };
855   }
856 
foo(A::X<int> & ax,B::X<int> bx)857   void foo(A::X<int> &ax, B::X<int> bx) {
858     // CHECK-ELIDE-NOTREE: no viable overloaded '='
859     // CHECK-ELIDE-NOTREE: no known conversion from 'B::X<int>' to 'const rdar12931988::A::X<int>'
860     ax = bx;
861   }
862 
863   template<template<typename> class> class Y {};
864 
bar(Y<A::X> ya,Y<B::X> yb)865   void bar(Y<A::X> ya, Y<B::X> yb) {
866     // CHECK-ELIDE-NOTREE: no viable overloaded '='
867     // CHECK-ELIDE-NOTREE: no known conversion from 'Y<template rdar12931988::B::X>' to 'Y<template rdar12931988::A::X>'
868     ya = yb;
869   }
870 }
871 
872 namespace ValueDecl {
873   int int1, int2, default_int;
874   template <const int& T = default_int>
875   struct S {};
876 
877   typedef S<int1> T1;
878   typedef S<int2> T2;
879   typedef S<> TD;
880 
test()881   void test() {
882     T1 t1;
883     T2 t2;
884     TD td;
885 
886     t1 = t2;
887     // CHECK-ELIDE-NOTREE: no viable overloaded '='
888     // CHECK-ELIDE-NOTREE: no known conversion from 'S<int2>' to 'S<int1>'
889 
890     t2 = t1;
891     // CHECK-ELIDE-NOTREE: no viable overloaded '='
892     // CHECK-ELIDE-NOTREE: no known conversion from 'S<int1>' to 'S<int2>'
893 
894     td = t1;
895     // TODO: Find out why (default) isn't printed on second template.
896     // CHECK-ELIDE-NOTREE: no viable overloaded '='
897     // CHECK-ELIDE-NOTREE: no known conversion from 'S<int1>' to 'S<default_int>'
898 
899     t2 = td;
900     // CHECK-ELIDE-NOTREE: no viable overloaded '='
901     // CHECK-ELIDE-NOTREE: no known conversion from 'S<(default) default_int>' to 'S<int2>'
902 
903   }
904 }
905 
906 // CHECK-ELIDE-NOTREE: {{[0-9]*}} errors generated.
907 // CHECK-NOELIDE-NOTREE: {{[0-9]*}} errors generated.
908 // CHECK-ELIDE-TREE: {{[0-9]*}} errors generated.
909 // CHECK-NOELIDE-TREE: {{[0-9]*}} errors generated.
910 
911