diag-template-diffing.cpp 56 KB

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