1// RUN: not %clang_cc1 -fsyntax-only %s -std=c++11 2>&1 | FileCheck %s -check-prefix=CHECK-ELIDE-NOTREE
2// RUN: not %clang_cc1 -fsyntax-only %s -fno-elide-type -std=c++11 2>&1 | FileCheck %s -check-prefix=CHECK-NOELIDE-NOTREE
3// RUN: not %clang_cc1 -fsyntax-only %s -fdiagnostics-show-template-tree -std=c++11 2>&1 | FileCheck %s -check-prefix=CHECK-ELIDE-TREE
4// RUN: not %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.
9class versa_string;
10typedef versa_string string;
11
12namespace std {template <typename T> class vector;}
13using std::vector;
14
15void f(vector<string> v);
16
17namespace std {
18  class basic_string;
19  typedef basic_string string;
20  template <typename T> class vector {};
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
39template <int... A>
40class I1{};
41void set1(I1<1,2,3,4,2,3,4,3>) {};
42void 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
69template <class A, class B, class C = void>
70class I2{};
71void set2(I2<int, int>) {};
72void 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
92int V1, V2, V3;
93template <int* A, int *B>
94class I3{};
95void set3(I3<&V1, &V2>) {};
96void 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
114template <class A, class B>
115class Alpha{};
116template <class A, class B>
117class Beta{};
118template <class A, class B>
119class Gamma{};
120template <class A, class B>
121class Delta{};
122
123void set4(Alpha<int, int>);
124void 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
136void set5(Alpha<Beta<Gamma<Delta<int, int>, int>, int>, int>);
137void 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
163void 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
185int a7, b7;
186int c7[] = {1,2,3};
187template<int *A>
188class class7 {};
189void set7(class7<&a7> A) {}
190void 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
233template<typename ...T> struct S8 {};
234template<typename T> using U8 = S8<int, char, T>;
235int f8(S8<int, char, double>);
236int 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
253template<typename ...T> struct S9 {};
254template<typename T> using U9 = S9<int, char, T>;
255template<typename T> using V9 = U9<U9<T>>;
256int f9(S9<int, char, U9<const double>>);
257int 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
280template<typename ...A> class class_types {};
281void set10(class_types<int, int>) {}
282void 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
317template<int ...A> class class_ints {};
318void set11(class_ints<2, 3>) {}
319void 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
354template<template<class> class ...A> class class_template_templates {};
355template<class> class tt1 {};
356template<class> class tt2 {};
357void set12(class_template_templates<tt1, tt1>) {}
358void 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
392double a13, b13, c13, d13;
393template<double* ...A> class class_ptrs {};
394void set13(class_ptrs<&a13, &b13>) {}
395void 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
429template<typename T> struct s14 {};
430template<typename T> using a14 = s14<T>;
431typedef a14<int> b14;
432template<typename T> using c14 = b14;
433int f14(c14<int>);
434int 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
448void set15(vector<vector<int>>) {}
449void 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
458void set16(vector<const vector<int>>) {}
459void 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
477void set17(vector<vector<int>>) {}
478void 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
496void set18(vector<const vector<int>>) {}
497void 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
515void set19(vector<volatile vector<int>>) {}
516void 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
534void set20(vector<const volatile vector<int>>) {}
535void 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.
555template<typename T> struct S21 {};
556template<typename T> using U21 = volatile S21<T>;
557int f21(vector<const U21<int>>);
558int 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.
575template<typename T> struct S22 {};
576template<typename T> using U22 = volatile S22<T>;
577int f22(vector<volatile const U22<int>>);
578int 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.
595template <class T> struct D23{};
596template <class T> using C23 = D23<T>;
597typedef const C23<int> B23;
598template<class ...T> using A23 = B23;
599
600void foo23(D23<A23<>> b) {}
601void 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
633namespace PR14015 {
634template <unsigned N> class Foo1 {};
635template <unsigned N = 2> class Foo2 {};
636template <unsigned ...N> class Foo3 {};
637
638void 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 'const 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 'const 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 'const 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 'const 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:   [(no qualifiers) != const] 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:   [(no qualifiers) != const] 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:   [(no qualifiers) != const] 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:   [(no qualifiers) != const] 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
688void 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 'const 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 'const 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 'const 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 'const 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:   [(no qualifiers) != const] 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:   [(no qualifiers) != const] 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:   [(no qualifiers) != const] 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:   [(no qualifiers) != const] 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
737void 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 'const 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 'const 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 'const 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 'const 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:   [(no qualifiers) != const] 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:   [(no qualifiers) != const] 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:   [(no qualifiers) != const] 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:   [(no qualifiers) != const] 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
795namespace 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
803namespace 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   {
809    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
815namespace 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
833namespace PR15023 {
834  // Don't crash when non-QualTypes are passed to a diff modifier.
835  template <typename... Args>
836  void func(void (*func)(Args...), Args...) { }
837
838  void bar(int, int &) {
839  }
840
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
848namespace rdar12931988 {
849  namespace A {
850    template<typename T> struct X { };
851  }
852
853  namespace B {
854    template<typename T> struct X { };
855  }
856
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
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
872namespace 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
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
906namespace DependentDefault {
907  template <typename> struct Trait {
908    enum { V = 40 };
909    typedef int Ty;
910    static int I;
911  };
912  int other;
913
914  template <typename T, int = Trait<T>::V > struct A {};
915  template <typename T, typename = Trait<T>::Ty > struct B {};
916  template <typename T, int& = Trait<T>::I > struct C {};
917
918  void test() {
919
920    A<int> a1;
921    A<char> a2;
922    A<int, 10> a3;
923    a1 = a2;
924    // CHECK-ELIDE-NOTREE: no viable overloaded '='
925    // CHECK-ELIDE-NOTREE: no known conversion from 'A<char, [...]>' to 'A<int, [...]>'
926    a3 = a1;
927    // CHECK-ELIDE-NOTREE: no viable overloaded '='
928    // CHECK-ELIDE-NOTREE: no known conversion from 'A<[...], (default) 40>' to 'A<[...], 10>'
929    a2 = a3;
930    // CHECK-ELIDE-NOTREE: no viable overloaded '='
931    // CHECK-ELIDE-NOTREE: no known conversion from 'A<int, 10>' to 'A<char, 40>'
932
933    B<int> b1;
934    B<char> b2;
935    B<int, char> b3;
936    b1 = b2;
937    // CHECK-ELIDE-NOTREE: no viable overloaded '='
938    // CHECK-ELIDE-NOTREE: no known conversion from 'B<char, [...]>' to 'B<int, [...]>'
939    b3 = b1;
940    // CHECK-ELIDE-NOTREE: no viable overloaded '='
941    // CHECK-ELIDE-NOTREE: no known conversion from 'B<[...], (default) int>' to 'B<[...], char>'
942    b2 = b3;
943    // CHECK-ELIDE-NOTREE: no viable overloaded '='
944    // CHECK-ELIDE-NOTREE: no known conversion from 'B<int, char>' to 'B<char, int>'
945
946    C<int> c1;
947    C<char> c2;
948    C<int, other> c3;
949    c1 = c2;
950    // CHECK-ELIDE-NOTREE: no viable overloaded '='
951    // CHECK-ELIDE-NOTREE: no known conversion from 'C<char, (default) I>' to 'C<int, I>'
952    c3 = c1;
953    // CHECK-ELIDE-NOTREE: no viable overloaded '='
954    // CHECK-ELIDE-NOTREE: no known conversion from 'C<[...], (default) I>' to 'C<[...], other>'
955    c2 = c3;
956    // CHECK-ELIDE-NOTREE: no viable overloaded '='
957    // CHECK-ELIDE-NOTREE: no known conversion from 'C<int, other>' to 'C<char, I>'
958  }
959}
960
961namespace VariadicDefault {
962  int i1, i2, i3;
963  template <int = 5, int...> struct A {};
964  template <int& = i1, int& ...> struct B {};
965  template <typename = void, typename...> struct C {};
966
967  void test() {
968    A<> a1;
969    A<5, 6, 7> a2;
970    A<1, 2> a3;
971    a2 = a1;
972    // CHECK-ELIDE-NOTREE: no viable overloaded '='
973    // CHECK-ELIDE-NOTREE: no known conversion from 'A<[...], (no argument), (no argument)>' to 'A<[...], 6, 7>'
974    a3 = a1;
975    // CHECK-ELIDE-NOTREE: no viable overloaded '='
976    // CHECK-ELIDE-NOTREE: no known conversion from 'A<(default) 5, (no argument)>' to 'A<1, 2>'
977
978    B<> b1;
979    B<i1, i2, i3> b2;
980    B<i2, i3> b3;
981    b2 = b1;
982    // CHECK-ELIDE-NOTREE: no viable overloaded '='
983    // CHECK-ELIDE-NOTREE: no known conversion from 'B<[...], (no argument), (no argument)>' to 'B<[...], i2, i3>'
984    b3 = b1;
985    // CHECK-ELIDE-NOTREE: no viable overloaded '='
986    // CHECK-ELIDE-NOTREE: no known conversion from 'B<(default) i1, (no argument)>' to 'B<i2, i3>'
987
988    B<i1, i2, i3> b4 = b1;
989    // CHECK-ELIDE-NOTREE: no viable conversion from 'B<[...], (no argument), (no argument)>' to 'B<[...], i2, i3>'
990    B<i2, i3> b5 = b1;
991    // CHECK-ELIDE-NOTREE: no viable conversion from 'B<(default) i1, (no argument)>' to 'B<i2, i3>'
992
993    C<> c1;
994    C<void, void> c2;
995    C<char, char> c3;
996    c2 = c1;
997    // CHECK-ELIDE-NOTREE: no viable overloaded '='
998    // CHECK-ELIDE-NOTREE: no known conversion from 'C<[...], (no argument)>' to 'C<[...], void>'
999    c3 = c1;
1000    // CHECK-ELIDE-NOTREE: no viable overloaded '='
1001    // CHECK-ELIDE-NOTREE: no known conversion from 'C<(default) void, (no argument)>' to 'C<char, char>'
1002  }
1003}
1004
1005namespace PointerArguments {
1006  template <int *p> class T {};
1007  template <int* ...> class U {};
1008  int a, b, c;
1009  int z[5];
1010  void test() {
1011    T<&a> ta;
1012    T<z> tz;
1013    T<&b> tb(ta);
1014    // CHECK-ELIDE-NOTREE: no matching constructor for initialization of 'T<&b>'
1015    // CHECK-ELIDE-NOTREE: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'T<&a>' to 'const T<&b>' for 1st argument
1016    T<&c> tc(tz);
1017    // CHECK-ELIDE-NOTREE: no matching constructor for initialization of 'T<&c>'
1018    // CHECK-ELIDE-NOTREE: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'T<z>' to 'const T<&c>' for 1st argument
1019
1020    U<&a, &a> uaa;
1021    U<&b> ub(uaa);
1022    // CHECK-ELIDE-NOTREE: no matching constructor for initialization of 'U<&b>'
1023    // CHECK-ELIDE-NOTREE: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'U<&a, &a>' to 'const U<&b, (no argument)>' for 1st argument
1024
1025    U<&b, &b, &b> ubbb(uaa);
1026    // CHECK-ELIDE-NOTREE: no matching constructor for initialization of 'U<&b, &b, &b>'
1027    // CHECK-ELIDE-NOTREE: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'U<&a, &a, (no argument)>' to 'const U<&b, &b, &b>' for 1st argument
1028
1029  }
1030}
1031
1032namespace DependentInt {
1033  template<int Num> struct INT;
1034
1035  template <class CLASS, class Int_wrapper = INT<CLASS::val> >
1036  struct C;
1037
1038  struct N {
1039    static const int val = 1;
1040  };
1041
1042  template <class M_T>
1043  struct M {};
1044
1045  void test() {
1046    using T1 = M<C<int, INT<0>>>;
1047    using T2 = M<C<N>>;
1048    T2 p;
1049    T1 x = p;
1050    // CHECK-ELIDE-NOTREE: no viable conversion from 'M<C<struct DependentInt::N, INT<1>>>' to 'M<C<int, INT<0>>>'
1051  }
1052}
1053
1054namespace PR17510 {
1055class Atom;
1056
1057template <typename T> class allocator;
1058template <typename T, typename A> class vector;
1059
1060typedef vector<const Atom *, allocator<const Atom *> > AtomVector;
1061
1062template <typename T, typename A = allocator<const Atom *> > class vector {};
1063
1064void foo() {
1065  vector<Atom *> v;
1066  AtomVector v2(v);
1067  // CHECK-ELIDE-NOTREE: no known conversion from 'vector<class PR17510::Atom *, [...]>' to 'const vector<const class PR17510::Atom *, [...]>'
1068}
1069}
1070
1071namespace PR15677 {
1072template <bool>
1073struct A{};
1074
1075template <typename T>
1076using B = A<T::value>;
1077
1078template <typename T>
1079using B = A<!T::value>;
1080// CHECK-ELIDE-NOTREE: type alias template redefinition with different types ('A<!T::value>' vs 'A<T::value>')
1081
1082template <int>
1083struct C{};
1084
1085template <typename T>
1086using D = C<T::value>;
1087
1088template <typename T>
1089using D = C<T::value + 1>;
1090// CHECK-ELIDE-NOTREE: type alias template redefinition with different types ('C<T::value + 1>' vs 'C<T::value>')
1091
1092template <typename T>
1093using E = C<T::value>;
1094
1095template <typename T>
1096using E = C<42>;
1097// CHECK-ELIDE-NOTREE: type alias template redefinition with different types ('C<42>' vs 'C<T::value>')
1098
1099template <typename T>
1100using F = C<T::value>;
1101
1102template <typename T>
1103using F = C<21 + 21>;
1104// CHECK-ELIDE-NOTREE: type alias template redefinition with different types ('C<21 + 21 aka 42>' vs 'C<T::value>')
1105}
1106}
1107
1108// CHECK-ELIDE-NOTREE: {{[0-9]*}} errors generated.
1109// CHECK-NOELIDE-NOTREE: {{[0-9]*}} errors generated.
1110// CHECK-ELIDE-TREE: {{[0-9]*}} errors generated.
1111// CHECK-NOELIDE-TREE: {{[0-9]*}} errors generated.
1112