blob: add96efd37b63468c4726067c99e197888fcb5ba [file] [log] [blame]
Richard Trieu246b6aa2012-06-26 18:18:47 +00001// 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.
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'
Richard Trieu648e7632012-06-29 23:11:10 +000031// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +000032// 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'
Richard Trieu648e7632012-06-29 23:11:10 +000035// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +000036// 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'
Richard Trieu648e7632012-06-29 23:11:10 +000050// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +000051// 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'
Richard Trieu648e7632012-06-29 23:11:10 +000057// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +000058// 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'
Richard Trieu648e7632012-06-29 23:11:10 +000080// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +000081// 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'
Richard Trieu648e7632012-06-29 23:11:10 +000086// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +000087// 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'
Richard Trieu648e7632012-06-29 23:11:10 +0000104// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000105// 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'
Richard Trieu648e7632012-06-29 23:11:10 +0000109// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000110// 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'
Richard Trieu648e7632012-06-29 23:11:10 +0000145// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000146// 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'
Richard Trieu648e7632012-06-29 23:11:10 +0000154// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000155// 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'
Richard Trieu648e7632012-06-29 23:11:10 +0000171// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000172// 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'
Richard Trieu648e7632012-06-29 23:11:10 +0000178// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000179// 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'
Matt Beaumont-Gay712692e2012-06-28 19:20:41 +0000197// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class7<&b7>' to 'class7<&a7>' for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000198// CHECK-ELIDE-NOTREE: no matching function for call to 'set7'
Matt Beaumont-Gay712692e2012-06-28 19:20:41 +0000199// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class7<c7>' to 'class7<&a7>' for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000200// CHECK-ELIDE-NOTREE: no matching function for call to 'set7'
Matt Beaumont-Gay712692e2012-06-28 19:20:41 +0000201// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class7<nullptr>' to 'class7<&a7>' for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000202// CHECK-NOELIDE-NOTREE: no matching function for call to 'set7'
Matt Beaumont-Gay712692e2012-06-28 19:20:41 +0000203// CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class7<&b7>' to 'class7<&a7>' for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000204// CHECK-NOELIDE-NOTREE: no matching function for call to 'set7'
Matt Beaumont-Gay712692e2012-06-28 19:20:41 +0000205// CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class7<c7>' to 'class7<&a7>' for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000206// CHECK-NOELIDE-NOTREE: no matching function for call to 'set7'
Matt Beaumont-Gay712692e2012-06-28 19:20:41 +0000207// CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class7<nullptr>' to 'class7<&a7>' for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000208// CHECK-ELIDE-TREE: no matching function for call to 'set7'
Richard Trieu648e7632012-06-29 23:11:10 +0000209// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000210// CHECK-ELIDE-TREE: class7<
211// CHECK-ELIDE-TREE: [&b7 != &a7]>
212// CHECK-ELIDE-TREE: no matching function for call to 'set7'
Richard Trieu648e7632012-06-29 23:11:10 +0000213// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000214// CHECK-ELIDE-TREE: class7<
215// CHECK-ELIDE-TREE: [c7 != &a7]>
216// CHECK-ELIDE-TREE: no matching function for call to 'set7'
Richard Trieu648e7632012-06-29 23:11:10 +0000217// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000218// CHECK-ELIDE-TREE: class7<
219// CHECK-ELIDE-TREE: [nullptr != &a7]>
220// CHECK-NOELIDE-TREE: no matching function for call to 'set7'
Richard Trieu648e7632012-06-29 23:11:10 +0000221// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000222// CHECK-NOELIDE-TREE: class7<
223// CHECK-NOELIDE-TREE: [&b7 != &a7]>
224// CHECK-NOELIDE-TREE: no matching function for call to 'set7'
Richard Trieu648e7632012-06-29 23:11:10 +0000225// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000226// CHECK-NOELIDE-TREE: class7<
227// CHECK-NOELIDE-TREE: [c7 != &a7]>
228// CHECK-NOELIDE-TREE: no matching function for call to 'set7'
Richard Trieu648e7632012-06-29 23:11:10 +0000229// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000230// 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'
Matt Beaumont-Gay712692e2012-06-28 19:20:41 +0000238// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'S8<[2 * ...], char>' to 'S8<[2 * ...], double>' for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000239// CHECK-NOELIDE-NOTREE: no matching function for call to 'f8'
Matt Beaumont-Gay712692e2012-06-28 19:20:41 +0000240// CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'S8<int, char, char>' to 'S8<int, char, double>' for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000241// CHECK-ELIDE-TREE: no matching function for call to 'f8'
Richard Trieu648e7632012-06-29 23:11:10 +0000242// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000243// 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'
Richard Trieu648e7632012-06-29 23:11:10 +0000247// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000248// 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'
Matt Beaumont-Gay712692e2012-06-28 19:20:41 +0000260// 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
Richard Trieu246b6aa2012-06-26 18:18:47 +0000261// CHECK-NOELIDE-NOTREE: no matching function for call to 'f9'
Matt Beaumont-Gay712692e2012-06-28 19:20:41 +0000262// 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
Richard Trieu246b6aa2012-06-26 18:18:47 +0000263// CHECK-ELIDE-TREE: no matching function for call to 'f9'
Richard Trieu648e7632012-06-29 23:11:10 +0000264// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000265// 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'
Richard Trieu648e7632012-06-29 23:11:10 +0000271// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000272// 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'
Matt Beaumont-Gay712692e2012-06-28 19:20:41 +0000288// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class_types<[...], (no argument)>' to 'class_types<[...], int>' for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000289// CHECK-ELIDE-NOTREE: no matching function for call to 'set10'
Matt Beaumont-Gay712692e2012-06-28 19:20:41 +0000290// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class_types<[2 * ...], int>' to 'class_types<[2 * ...], (no argument)>' for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000291// CHECK-NOELIDE-NOTREE: no matching function for call to 'set10'
Matt Beaumont-Gay712692e2012-06-28 19:20:41 +0000292// CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class_types<int, (no argument)>' to 'class_types<int, int>' for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000293// CHECK-NOELIDE-NOTREE: no matching function for call to 'set10'
Matt Beaumont-Gay712692e2012-06-28 19:20:41 +0000294// 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
Richard Trieu246b6aa2012-06-26 18:18:47 +0000295// CHECK-ELIDE-TREE: no matching function for call to 'set10'
Richard Trieu648e7632012-06-29 23:11:10 +0000296// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000297// 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'
Richard Trieu648e7632012-06-29 23:11:10 +0000301// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000302// 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'
Richard Trieu648e7632012-06-29 23:11:10 +0000306// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000307// 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'
Richard Trieu648e7632012-06-29 23:11:10 +0000311// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000312// 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'
Matt Beaumont-Gay712692e2012-06-28 19:20:41 +0000324// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class_ints<1, (no argument)>' to 'class_ints<2, 3>' for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000325// CHECK-ELIDE-NOTREE: no matching function for call to 'set11'
Matt Beaumont-Gay712692e2012-06-28 19:20:41 +0000326// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class_ints<0, [...], 6>' to 'class_ints<2, [...], (no argument)>' for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000327// CHECK-NOELIDE-NOTREE: no matching function for call to 'set11'
Matt Beaumont-Gay712692e2012-06-28 19:20:41 +0000328// CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class_ints<1, (no argument)>' to 'class_ints<2, 3>' for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000329// CHECK-NOELIDE-NOTREE: no matching function for call to 'set11'
Matt Beaumont-Gay712692e2012-06-28 19:20:41 +0000330// 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
Richard Trieu246b6aa2012-06-26 18:18:47 +0000331// CHECK-ELIDE-TREE: no matching function for call to 'set11'
Richard Trieu648e7632012-06-29 23:11:10 +0000332// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000333// 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'
Richard Trieu648e7632012-06-29 23:11:10 +0000337// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000338// 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'
Richard Trieu648e7632012-06-29 23:11:10 +0000343// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000344// 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'
Richard Trieu648e7632012-06-29 23:11:10 +0000348// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000349// 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'
Matt Beaumont-Gay712692e2012-06-28 19:20:41 +0000363// 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
Richard Trieu246b6aa2012-06-26 18:18:47 +0000364// CHECK-ELIDE-NOTREE: no matching function for call to 'set12'
Matt Beaumont-Gay712692e2012-06-28 19:20:41 +0000365// 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
Richard Trieu246b6aa2012-06-26 18:18:47 +0000366// CHECK-NOELIDE-NOTREE: no matching function for call to 'set12'
Matt Beaumont-Gay712692e2012-06-28 19:20:41 +0000367// 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
Richard Trieu246b6aa2012-06-26 18:18:47 +0000368// CHECK-NOELIDE-NOTREE: no matching function for call to 'set12'
Matt Beaumont-Gay712692e2012-06-28 19:20:41 +0000369// 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
Richard Trieu246b6aa2012-06-26 18:18:47 +0000370// CHECK-ELIDE-TREE: no matching function for call to 'set12'
Richard Trieu648e7632012-06-29 23:11:10 +0000371// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000372// 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'
Richard Trieu648e7632012-06-29 23:11:10 +0000376// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000377// 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'
Richard Trieu648e7632012-06-29 23:11:10 +0000381// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000382// 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'
Richard Trieu648e7632012-06-29 23:11:10 +0000386// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000387// 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'
Matt Beaumont-Gay712692e2012-06-28 19:20:41 +0000400// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class_ptrs<&c13, (no argument)>' to 'class_ptrs<&a13, &b13>' for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000401// CHECK-ELIDE-NOTREE: no matching function for call to 'set13'
Matt Beaumont-Gay712692e2012-06-28 19:20:41 +0000402// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class_ptrs<[2 * ...], &d13>' to 'class_ptrs<[2 * ...], (no argument)>' for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000403// CHECK-NOELIDE-NOTREE: no matching function for call to 'set13'
Matt Beaumont-Gay712692e2012-06-28 19:20:41 +0000404// CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class_ptrs<&c13, (no argument)>' to 'class_ptrs<&a13, &b13>' for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000405// CHECK-NOELIDE-NOTREE: no matching function for call to 'set13'
Matt Beaumont-Gay712692e2012-06-28 19:20:41 +0000406// 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
Richard Trieu246b6aa2012-06-26 18:18:47 +0000407// CHECK-ELIDE-TREE: no matching function for call to 'set13'
Richard Trieu648e7632012-06-29 23:11:10 +0000408// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000409// 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'
Richard Trieu648e7632012-06-29 23:11:10 +0000413// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000414// 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'
Richard Trieu648e7632012-06-29 23:11:10 +0000418// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000419// 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'
Richard Trieu648e7632012-06-29 23:11:10 +0000423// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
Richard Trieu246b6aa2012-06-26 18:18:47 +0000424// CHECK-NOELIDE-TREE: class_ptrs<
425// CHECK-NOELIDE-TREE: &a13,
426// CHECK-NOELIDE-TREE: &b13,
427// CHECK-NOELIDE-TREE: [&d13 != (no argument)]>
428
Richard Smith07381982012-09-26 02:18:13 +0000429template<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]>
Richard Trieu246b6aa2012-06-26 18:18:47 +0000447
Richard Trieu3c883012012-09-28 20:32:51 +0000448void 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
Richard Trieu54c45452012-11-01 21:29:28 +0000633namespace 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 '='
Richard Trieu060fe332013-03-23 01:38:36 +0000648// 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
Richard Trieu54c45452012-11-01 21:29:28 +0000649// 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 '='
Richard Trieu060fe332013-03-23 01:38:36 +0000651// 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
Richard Trieu54c45452012-11-01 21:29:28 +0000652// 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 '='
Richard Trieu060fe332013-03-23 01:38:36 +0000654// 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
Richard Trieu54c45452012-11-01 21:29:28 +0000655// 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 '='
Richard Trieu060fe332013-03-23 01:38:36 +0000657// 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
Richard Trieu54c45452012-11-01 21:29:28 +0000658// 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
Richard Trieu060fe332013-03-23 01:38:36 +0000661// CHECK-ELIDE-TREE: [(no qualifiers) != const] Foo1<
Richard Trieu54c45452012-11-01 21:29:28 +0000662// 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
Richard Trieu060fe332013-03-23 01:38:36 +0000668// CHECK-ELIDE-TREE: [(no qualifiers) != const] Foo1<
Richard Trieu54c45452012-11-01 21:29:28 +0000669// 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
Richard Trieu060fe332013-03-23 01:38:36 +0000675// CHECK-NOELIDE-TREE: [(no qualifiers) != const] Foo1<
Richard Trieu54c45452012-11-01 21:29:28 +0000676// 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
Richard Trieu060fe332013-03-23 01:38:36 +0000682// CHECK-NOELIDE-TREE: [(no qualifiers) != const] Foo1<
Richard Trieu54c45452012-11-01 21:29:28 +0000683// 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 '='
Richard Trieu060fe332013-03-23 01:38:36 +0000697// 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
Richard Trieu54c45452012-11-01 21:29:28 +0000698// 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 '='
Richard Trieu060fe332013-03-23 01:38:36 +0000700// 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
Richard Trieu54c45452012-11-01 21:29:28 +0000701// 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 '='
Richard Trieu060fe332013-03-23 01:38:36 +0000703// 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
Richard Trieu54c45452012-11-01 21:29:28 +0000704// 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 '='
Richard Trieu060fe332013-03-23 01:38:36 +0000706// 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
Richard Trieu54c45452012-11-01 21:29:28 +0000707// 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
Richard Trieu060fe332013-03-23 01:38:36 +0000710// CHECK-ELIDE-TREE: [(no qualifiers) != const] Foo2<
Richard Trieu54c45452012-11-01 21:29:28 +0000711// 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
Richard Trieu060fe332013-03-23 01:38:36 +0000717// CHECK-ELIDE-TREE: [(no qualifiers) != const] Foo2<
Richard Trieu54c45452012-11-01 21:29:28 +0000718// 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
Richard Trieu060fe332013-03-23 01:38:36 +0000724// CHECK-NOELIDE-TREE: [(no qualifiers) != const] Foo2<
Richard Trieu54c45452012-11-01 21:29:28 +0000725// 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
Richard Trieu060fe332013-03-23 01:38:36 +0000731// CHECK-NOELIDE-TREE: [(no qualifiers) != const] Foo2<
Richard Trieu54c45452012-11-01 21:29:28 +0000732// 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 '='
Richard Trieu060fe332013-03-23 01:38:36 +0000746// 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
Richard Trieu54c45452012-11-01 21:29:28 +0000747// 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 '='
Richard Trieu060fe332013-03-23 01:38:36 +0000749// 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
Richard Trieu54c45452012-11-01 21:29:28 +0000750// 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 '='
Richard Trieu060fe332013-03-23 01:38:36 +0000752// 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
Richard Trieu54c45452012-11-01 21:29:28 +0000753// 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 '='
Richard Trieu060fe332013-03-23 01:38:36 +0000755// 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
Richard Trieu54c45452012-11-01 21:29:28 +0000756// 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
Richard Trieu060fe332013-03-23 01:38:36 +0000759// CHECK-ELIDE-TREE: [(no qualifiers) != const] Foo3<
Richard Trieu54c45452012-11-01 21:29:28 +0000760// 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
Richard Trieu060fe332013-03-23 01:38:36 +0000768// CHECK-ELIDE-TREE: [(no qualifiers) != const] Foo3<
Richard Trieu54c45452012-11-01 21:29:28 +0000769// 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
Richard Trieu060fe332013-03-23 01:38:36 +0000777// CHECK-NOELIDE-TREE: [(no qualifiers) != const] Foo3<
Richard Trieu54c45452012-11-01 21:29:28 +0000778// 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
Richard Trieu060fe332013-03-23 01:38:36 +0000786// CHECK-NOELIDE-TREE: [(no qualifiers) != const] Foo3<
Richard Trieu54c45452012-11-01 21:29:28 +0000787// 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
Eli Friedman924d5c92012-11-14 23:57:08 +0000795namespace 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, [...]>'
Richard Trieu70e82dc2013-03-15 23:55:09 +0000800 // CHECK-ELIDE-NOTREE: error: no viable conversion from 'X<[...], 2>' to 'X<[...], 3>'
Eli Friedman924d5c92012-11-14 23:57:08 +0000801}
Richard Trieu54c45452012-11-01 21:29:28 +0000802
Eli Friedman1850ac62012-12-18 23:32:47 +0000803namespace 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
Douglas Gregor33515362012-12-21 23:03:27 +0000815namespace 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
Richard Trieu877761c2013-01-30 20:04:31 +0000833namespace 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
Douglas Gregor11667232013-01-31 01:08:35 +0000848namespace 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 }
Richard Trieuf499b342013-01-31 02:47:46 +0000862
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 }
Douglas Gregor11667232013-01-31 01:08:35 +0000870}
871
Richard Trieuda891052013-02-27 01:41:53 +0000872namespace 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
Richard Trieu625785d2013-04-03 02:11:36 +0000906namespace 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, (default) Trait<T>::Ty>' to 'B<int, int>'
939 b3 = b1;
940 // CHECK-ELIDE-NOTREE: no viable overloaded '='
941 // CHECK-ELIDE-NOTREE: no known conversion from 'B<[...], (default) Trait<T>::Ty>' 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
Richard Trieufa3d2752013-04-03 02:22:12 +0000961namespace 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
Richard Trieu709caea2013-04-03 02:31:17 +0000988 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
Richard Trieufa3d2752013-04-03 02:22:12 +0000993 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
Richard Trieu246b6aa2012-06-26 18:18:47 +00001005// CHECK-ELIDE-NOTREE: {{[0-9]*}} errors generated.
1006// CHECK-NOELIDE-NOTREE: {{[0-9]*}} errors generated.
1007// CHECK-ELIDE-TREE: {{[0-9]*}} errors generated.
1008// CHECK-NOELIDE-TREE: {{[0-9]*}} errors generated.
Douglas Gregor11667232013-01-31 01:08:35 +00001009