brintos

brintos / llvm-project-archived public Read only

0
0
Text · 73.8 KiB · 0b14547 Raw
1523 lines · cpp
1// RUN: not %clang_cc1 -fsyntax-only %s -std=c++11 2>&1 | FileCheck %s -check-prefix=CHECK-ELIDE-NOTREE2// RUN: not %clang_cc1 -fsyntax-only %s -fno-elide-type -std=c++11 2>&1 | FileCheck %s -check-prefix=CHECK-NOELIDE-NOTREE3// RUN: not %clang_cc1 -fsyntax-only %s -fdiagnostics-show-template-tree -std=c++11 2>&1 | FileCheck %s -check-prefix=CHECK-ELIDE-TREE4// 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-TREE5 6// PR9548 - "no known conversion from 'vector<string>' to 'vector<string>'"7// vector<string> refers to two different types here.  Make sure the message8// 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 std26// CHECK-ELIDE-NOTREE: no matching function for call to 'f'27// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<std::basic_string>' to 'vector<versa_string>' for 1st argument28// CHECK-NOELIDE-NOTREE: no matching function for call to 'f'29// CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<std::basic_string>' to 'vector<versa_string>' for 1st argument30// CHECK-ELIDE-TREE: no matching function for call to 'f'31// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument32// CHECK-ELIDE-TREE:   vector<33// CHECK-ELIDE-TREE:     [std::basic_string != versa_string]>34// CHECK-NOELIDE-TREE: no matching function for call to 'f'35// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument36// CHECK-NOELIDE-TREE:   vector<37// CHECK-NOELIDE-TREE:     [std::basic_string != 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 argument47// 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 argument49// CHECK-ELIDE-TREE: no matching function for call to 'set1'50// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument51// CHECK-ELIDE-TREE:   I1<52// CHECK-ELIDE-TREE:     [5 * ...],53// CHECK-ELIDE-TREE:     [2 != 3],54// CHECK-ELIDE-TREE:     [2 * ...],55// CHECK-ELIDE-TREE:     [7 != (no argument)]>56// CHECK-NOELIDE-TREE: no matching function for call to 'set1'57// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument58// 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 argument77// 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 argument79// CHECK-ELIDE-TREE: no matching function for call to 'set2'80// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument81// CHECK-ELIDE-TREE:   I2<82// CHECK-ELIDE-TREE:     [double != int],83// CHECK-ELIDE-TREE:     [...],84// CHECK-ELIDE-TREE:     [int != (default) void]>85// CHECK-NOELIDE-TREE: no matching function for call to 'set2'86// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument87// 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 argument101// 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 argument103// CHECK-ELIDE-TREE: no matching function for call to 'set3'104// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument105// CHECK-ELIDE-TREE:   I3<106// CHECK-ELIDE-TREE:     [&V3 != &V1]107// CHECK-ELIDE-TREE:     [...]>108// CHECK-NOELIDE-TREE: no matching function for call to 'set3'109// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument110// 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 argument129// 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 argument131// 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 argument133// 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 argument135 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 argument142// 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 argument144// CHECK-ELIDE-TREE: no matching function for call to 'set5'145// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument146// CHECK-ELIDE-TREE:   Alpha<147// CHECK-ELIDE-TREE:     Beta<148// CHECK-ELIDE-TREE:       Gamma<149// CHECK-ELIDE-TREE:         [void != Delta<int, int>],150// CHECK-ELIDE-TREE:         [void != int]>151// CHECK-ELIDE-TREE:       [double != int]>152// CHECK-ELIDE-TREE:     [double != int]>153// CHECK-NOELIDE-TREE: no matching function for call to 'set5'154// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument155// 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 argument168// 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 argument170// CHECK-ELIDE-TREE: no matching function for call to 'set5'171// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument172// CHECK-ELIDE-TREE:   Alpha<173// CHECK-ELIDE-TREE:     Beta<174// CHECK-ELIDE-TREE:       [Delta<int, int> != Gamma<Delta<int, int>, int>],175// CHECK-ELIDE-TREE:       [...]>176// CHECK-ELIDE-TREE:     [...]>177// CHECK-NOELIDE-TREE: no matching function for call to 'set5'178// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument179// CHECK-NOELIDE-TREE:   Alpha<180// CHECK-NOELIDE-TREE:     Beta<181// CHECK-NOELIDE-TREE:       [Delta<int, int> != Gamma<Delta<int, int>, int>],182// CHECK-NOELIDE-TREE:       int>183// CHECK-NOELIDE-TREE:     int>184 185int a7, b7;186int c7[] = {1,2,3};187template<int *A>188class class7 {};189void set7(class7<&a7> A) {}190void test7() {191  set7(class7<&a7>());192  set7(class7<&b7>());193  set7(class7<c7>());194  set7(class7<nullptr>());195}196// CHECK-ELIDE-NOTREE: no matching function for call to 'set7'197// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class7<&b7>' to 'class7<&a7>' for 1st argument198// CHECK-ELIDE-NOTREE: no matching function for call to 'set7'199// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class7<c7>' to 'class7<&a7>' for 1st argument200// CHECK-ELIDE-NOTREE: no matching function for call to 'set7'201// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class7<nullptr>' to 'class7<&a7>' for 1st argument202// CHECK-NOELIDE-NOTREE: no matching function for call to 'set7'203// CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class7<&b7>' to 'class7<&a7>' for 1st argument204// CHECK-NOELIDE-NOTREE: no matching function for call to 'set7'205// CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class7<c7>' to 'class7<&a7>' for 1st argument206// CHECK-NOELIDE-NOTREE: no matching function for call to 'set7'207// CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class7<nullptr>' to 'class7<&a7>' for 1st argument208// CHECK-ELIDE-TREE: no matching function for call to 'set7'209// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument210// CHECK-ELIDE-TREE:   class7<211// CHECK-ELIDE-TREE:     [&b7 != &a7]>212// CHECK-ELIDE-TREE: no matching function for call to 'set7'213// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument214// CHECK-ELIDE-TREE:   class7<215// CHECK-ELIDE-TREE:     [c7 != &a7]>216// CHECK-ELIDE-TREE: no matching function for call to 'set7'217// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument218// CHECK-ELIDE-TREE:   class7<219// CHECK-ELIDE-TREE:     [nullptr != &a7]>220// CHECK-NOELIDE-TREE: no matching function for call to 'set7'221// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument222// CHECK-NOELIDE-TREE:   class7<223// CHECK-NOELIDE-TREE:     [&b7 != &a7]>224// CHECK-NOELIDE-TREE: no matching function for call to 'set7'225// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument226// CHECK-NOELIDE-TREE:   class7<227// CHECK-NOELIDE-TREE:     [c7 != &a7]>228// CHECK-NOELIDE-TREE: no matching function for call to 'set7'229// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument230// CHECK-NOELIDE-TREE:   class7<231// CHECK-NOELIDE-TREE:     [nullptr != &a7]>232 233template<typename ...T> struct S8 {};234template<typename T> using U8 = S8<int, char, T>;235int f8(S8<int, char, double>);236int k8 = f8(U8<char>());237// CHECK-ELIDE-NOTREE: no matching function for call to 'f8'238// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'S8<[2 * ...], char>' to 'S8<[2 * ...], double>' for 1st argument239// CHECK-NOELIDE-NOTREE: no matching function for call to 'f8'240// CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'S8<int, char, char>' to 'S8<int, char, double>' for 1st argument241// CHECK-ELIDE-TREE: no matching function for call to 'f8'242// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument243// CHECK-ELIDE-TREE:   S8<244// CHECK-ELIDE-TREE:     [2 * ...],245// CHECK-ELIDE-TREE:     [char != double]>246// CHECK-NOELIDE-TREE: no matching function for call to 'f8'247// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument248// CHECK-NOELIDE-TREE:   S8<249// CHECK-NOELIDE-TREE:     int,250// CHECK-NOELIDE-TREE:     char,251// CHECK-NOELIDE-TREE:     [char != double]>252 253template<typename ...T> struct S9 {};254template<typename T> using U9 = S9<int, char, T>;255template<typename T> using V9 = U9<U9<T>>;256int f9(S9<int, char, U9<const double>>);257int k9 = f9(V9<double>());258 259// CHECK-ELIDE-NOTREE: no matching function for call to 'f9'260// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'S9<[2 * ...], U9<double>>' to 'S9<[2 * ...], U9<const double>>' for 1st argument261// CHECK-NOELIDE-NOTREE: no matching function for call to 'f9'262// CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'S9<int, char, U9<double>>' to 'S9<int, char, U9<const double>>' for 1st argument263// CHECK-ELIDE-TREE: no matching function for call to 'f9'264// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument265// CHECK-ELIDE-TREE:   S9<266// CHECK-ELIDE-TREE:     [2 * ...],267// CHECK-ELIDE-TREE:     U9<268// CHECK-ELIDE-TREE:       [double != const double]>>269// CHECK-NOELIDE-TREE: no matching function for call to 'f9'270// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument271// CHECK-NOELIDE-TREE:   S9<272// CHECK-NOELIDE-TREE:     int,273// CHECK-NOELIDE-TREE:     char,274// CHECK-NOELIDE-TREE:     U9<275// CHECK-NOELIDE-TREE:       [double != const double]>>276 277template<typename ...A> class class_types {};278void set10(class_types<int, int>) {}279void test10() {280  set10(class_types<int>());281  set10(class_types<int, int, int>());282}283 284// CHECK-ELIDE-NOTREE: no matching function for call to 'set10'285// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class_types<[...], (no argument)>' to 'class_types<[...], int>' for 1st argument286// CHECK-ELIDE-NOTREE: no matching function for call to 'set10'287// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class_types<[2 * ...], int>' to 'class_types<[2 * ...], (no argument)>' for 1st argument288// CHECK-NOELIDE-NOTREE: no matching function for call to 'set10'289// CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class_types<int, (no argument)>' to 'class_types<int, int>' for 1st argument290// CHECK-NOELIDE-NOTREE: no matching function for call to 'set10'291// 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 argument292// CHECK-ELIDE-TREE: no matching function for call to 'set10'293// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument294// CHECK-ELIDE-TREE:   class_types<295// CHECK-ELIDE-TREE:     [...],296// CHECK-ELIDE-TREE:     [(no argument) != int]>297// CHECK-ELIDE-TREE: no matching function for call to 'set10'298// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument299// CHECK-ELIDE-TREE:   class_types<300// CHECK-ELIDE-TREE:     [2 * ...],301// CHECK-ELIDE-TREE:     [int != (no argument)]>302// CHECK-NOELIDE-TREE: no matching function for call to 'set10'303// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument304// CHECK-NOELIDE-TREE:   class_types<305// CHECK-NOELIDE-TREE:     int,306// CHECK-NOELIDE-TREE:     [(no argument) != int]>307// CHECK-NOELIDE-TREE: no matching function for call to 'set10'308// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument309// CHECK-NOELIDE-TREE:   class_types<310// CHECK-NOELIDE-TREE:     int,311// CHECK-NOELIDE-TREE:     int,312// CHECK-NOELIDE-TREE:     [int != (no argument)]>313 314template<int ...A> class class_ints {};315void set11(class_ints<2, 3>) {}316void test11() {317  set11(class_ints<1>());318  set11(class_ints<0, 3, 6>());319}320// CHECK-ELIDE-NOTREE: no matching function for call to 'set11'321// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class_ints<1, (no argument)>' to 'class_ints<2, 3>' for 1st argument322// CHECK-ELIDE-NOTREE: no matching function for call to 'set11'323// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class_ints<0, [...], 6>' to 'class_ints<2, [...], (no argument)>' for 1st argument324// CHECK-NOELIDE-NOTREE: no matching function for call to 'set11'325// CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class_ints<1, (no argument)>' to 'class_ints<2, 3>' for 1st argument326// CHECK-NOELIDE-NOTREE: no matching function for call to 'set11'327// 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 argument328// CHECK-ELIDE-TREE: no matching function for call to 'set11'329// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument330// CHECK-ELIDE-TREE:   class_ints<331// CHECK-ELIDE-TREE:     [1 != 2],332// CHECK-ELIDE-TREE:     [(no argument) != 3]>333// CHECK-ELIDE-TREE: no matching function for call to 'set11'334// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument335// CHECK-ELIDE-TREE:   class_ints<336// CHECK-ELIDE-TREE:     [0 != 2],337// CHECK-ELIDE-TREE:     [...],338// CHECK-ELIDE-TREE:     [6 != (no argument)]>339// CHECK-NOELIDE-TREE: no matching function for call to 'set11'340// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument341// CHECK-NOELIDE-TREE:   class_ints<342// CHECK-NOELIDE-TREE:     [1 != 2],343// CHECK-NOELIDE-TREE:     [(no argument) != 3]>344// CHECK-NOELIDE-TREE: no matching function for call to 'set11'345// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument346// CHECK-NOELIDE-TREE:   class_ints<347// CHECK-NOELIDE-TREE:     [0 != 2],348// CHECK-NOELIDE-TREE:     3,349// CHECK-NOELIDE-TREE:     [6 != (no argument)]>350 351template<template<class> class ...A> class class_template_templates {};352template<class> class tt1 {};353template<class> class tt2 {};354void set12(class_template_templates<tt1, tt1>) {}355void test12() {356  set12(class_template_templates<tt2>());357  set12(class_template_templates<tt1, tt1, tt1>());358}359// CHECK-ELIDE-NOTREE: no matching function for call to 'set12'360// 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 argument361// CHECK-ELIDE-NOTREE: no matching function for call to 'set12'362// 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 argument363// CHECK-NOELIDE-NOTREE: no matching function for call to 'set12'364// 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 argument365// CHECK-NOELIDE-NOTREE: no matching function for call to 'set12'366// 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 argument367// CHECK-ELIDE-TREE: no matching function for call to 'set12'368// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument369// CHECK-ELIDE-TREE:   class_template_templates<370// CHECK-ELIDE-TREE:     [template tt2 != template tt1],371// CHECK-ELIDE-TREE:     [template (no argument) != template tt1]>372// CHECK-ELIDE-TREE: no matching function for call to 'set12'373// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument374// CHECK-ELIDE-TREE:   class_template_templates<375// CHECK-ELIDE-TREE:     [2 * ...],376// CHECK-ELIDE-TREE:     [template tt1 != template (no argument)]>377// CHECK-NOELIDE-TREE: no matching function for call to 'set12'378// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument379// CHECK-NOELIDE-TREE:   class_template_templates<380// CHECK-NOELIDE-TREE:     [template tt2 != template tt1],381// CHECK-NOELIDE-TREE:     [template (no argument) != template tt1]>382// CHECK-NOELIDE-TREE: no matching function for call to 'set12'383// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument384// CHECK-NOELIDE-TREE:   class_template_templates<385// CHECK-NOELIDE-TREE:     template tt1,386// CHECK-NOELIDE-TREE:     template tt1,387// CHECK-NOELIDE-TREE:     [template tt1 != template (no argument)]>388 389double a13, b13, c13, d13;390template<double* ...A> class class_ptrs {};391void set13(class_ptrs<&a13, &b13>) {}392void test13() {393  set13(class_ptrs<&c13>());394  set13(class_ptrs<&a13, &b13, &d13>());395}396// CHECK-ELIDE-NOTREE: no matching function for call to 'set13'397// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class_ptrs<&c13, (no argument)>' to 'class_ptrs<&a13, &b13>' for 1st argument398// CHECK-ELIDE-NOTREE: no matching function for call to 'set13'399// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class_ptrs<[2 * ...], &d13>' to 'class_ptrs<[2 * ...], (no argument)>' for 1st argument400// CHECK-NOELIDE-NOTREE: no matching function for call to 'set13'401// CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class_ptrs<&c13, (no argument)>' to 'class_ptrs<&a13, &b13>' for 1st argument402// CHECK-NOELIDE-NOTREE: no matching function for call to 'set13'403// 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 argument404// CHECK-ELIDE-TREE: no matching function for call to 'set13'405// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument406// CHECK-ELIDE-TREE:   class_ptrs<407// CHECK-ELIDE-TREE:     [&c13 != &a13],408// CHECK-ELIDE-TREE:     [(no argument) != &b13]>409// CHECK-ELIDE-TREE: no matching function for call to 'set13'410// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument411// CHECK-ELIDE-TREE:   class_ptrs<412// CHECK-ELIDE-TREE:     [2 * ...],413// CHECK-ELIDE-TREE:     [&d13 != (no argument)]>414// CHECK-NOELIDE-TREE: no matching function for call to 'set13'415// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument416// CHECK-NOELIDE-TREE:   class_ptrs<417// CHECK-NOELIDE-TREE:     [&c13 != &a13],418// CHECK-NOELIDE-TREE:     [(no argument) != &b13]>419// CHECK-NOELIDE-TREE: no matching function for call to 'set13'420// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument421// CHECK-NOELIDE-TREE:   class_ptrs<422// CHECK-NOELIDE-TREE:     &a13,423// CHECK-NOELIDE-TREE:     &b13,424// CHECK-NOELIDE-TREE:     [&d13 != (no argument)]>425 426template<typename T> struct s14 {};427template<typename T> using a14 = s14<T>;428typedef a14<int> b14;429template<typename T> using c14 = b14;430int f14(c14<int>);431int k14 = f14(a14<char>());432// CHECK-ELIDE-NOTREE: no matching function for call to 'f14'433// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'a14<char>' to 'a14<int>' for 1st argument434// CHECK-NOELIDE-NOTREE: no matching function for call to 'f14'435// CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'a14<char>' to 'a14<int>' for 1st argument436// CHECK-ELIDE-TREE: no matching function for call to 'f14'437// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument438// CHECK-ELIDE-TREE:   a14<439// CHECK-ELIDE-TREE:     [char != int]>440// CHECK-NOELIDE-TREE: no matching function for call to 'f14'441// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument442// CHECK-NOELIDE-TREE:   a14<443// CHECK-NOELIDE-TREE:     [char != int]>444 445void set15(vector<vector<int>>) {}446void test15() {447  set15(vector<vector<int>>());448}449// CHECK-ELIDE-NOTREE-NOT: set15450// CHECK-NOELIDE-NOTREE-NOT: set15451// CHECK-ELIDE-TREE-NOT: set15452// CHECK-NOELIDE-TREE-NOT: set15453// no error here454 455void set16(vector<const vector<int>>) {}456void test16() {457  set16(vector<const vector<const int>>());458}459// CHECK-ELIDE-NOTREE: no matching function for call to 'set16'460// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<const vector<const int>>' to 'vector<const vector<int>>' for 1st argument461// CHECK-NOELIDE-NOTREE: no matching function for call to 'set16'462// CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<const vector<const int>>' to 'vector<const vector<int>>' for 1st argument463// CHECK-ELIDE-TREE: no matching function for call to 'set16'464// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument465// CHECK-ELIDE-TREE:   vector<466// CHECK-ELIDE-TREE:     const vector<467// CHECK-ELIDE-TREE:       [const != (no qualifiers)] int>>468// CHECK-NOELIDE-TREE: no matching function for call to 'set16'469// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument470// CHECK-NOELIDE-TREE:   vector<471// CHECK-NOELIDE-TREE:     const vector<472// CHECK-NOELIDE-TREE:       [const != (no qualifiers)] int>>473 474void set17(vector<vector<int>>) {}475void test17() {476  set17(vector<const vector<int>>());477}478// CHECK-ELIDE-NOTREE: no matching function for call to 'set17'479// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<const vector<...>>' to 'vector<vector<...>>' for 1st argument480// CHECK-NOELIDE-NOTREE: no matching function for call to 'set17'481// CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<const vector<int>>' to 'vector<vector<int>>' for 1st argument482// CHECK-ELIDE-TREE: no matching function for call to 'set17'483// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument484// CHECK-ELIDE-TREE:   vector<485// CHECK-ELIDE-TREE:     [const != (no qualifiers)] vector<...>>486// CHECK-NOELIDE-TREE: no matching function for call to 'set17'487// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument488// CHECK-NOELIDE-TREE:   vector<489// CHECK-NOELIDE-TREE:     [const != (no qualifiers)] vector<490// CHECK-NOELIDE-TREE:       int>>491 492void set18(vector<const vector<int>>) {}493void test18() {494  set18(vector<vector<int>>());495}496// CHECK-ELIDE-NOTREE: no matching function for call to 'set18'497// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<vector<...>>' to 'vector<const vector<...>>' for 1st argument498// CHECK-NOELIDE-NOTREE: no matching function for call to 'set18'499// CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<vector<int>>' to 'vector<const vector<int>>' for 1st argument500// CHECK-ELIDE-TREE: no matching function for call to 'set18'501// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument502// CHECK-ELIDE-TREE:   vector<503// CHECK-ELIDE-TREE:     [(no qualifiers) != const] vector<...>>504// CHECK-NOELIDE-TREE: no matching function for call to 'set18'505// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument506// CHECK-NOELIDE-TREE:   vector<507// CHECK-NOELIDE-TREE:     [(no qualifiers) != const] vector<508// CHECK-NOELIDE-TREE:       int>>509 510void set19(vector<volatile vector<int>>) {}511void test19() {512  set19(vector<const vector<int>>());513}514// CHECK-ELIDE-NOTREE: no matching function for call to 'set19'515// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<const vector<...>>' to 'vector<volatile vector<...>>' for 1st argument516// CHECK-NOELIDE-NOTREE: no matching function for call to 'set19'517// CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<const vector<int>>' to 'vector<volatile vector<int>>' for 1st argument518// CHECK-ELIDE-TREE: no matching function for call to 'set19'519// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument520// CHECK-ELIDE-TREE:   vector<521// CHECK-ELIDE-TREE:     [const != volatile] vector<...>>522// CHECK-NOELIDE-TREE: no matching function for call to 'set19'523// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument524// CHECK-NOELIDE-TREE:   vector<525// CHECK-NOELIDE-TREE:     [const != volatile] vector<526// CHECK-NOELIDE-TREE:       int>>527 528void set20(vector<const volatile vector<int>>) {}529void test20() {530  set20(vector<const vector<int>>());531}532// CHECK-ELIDE-NOTREE: no matching function for call to 'set20'533// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<const vector<...>>' to 'vector<const volatile vector<...>>' for 1st argument534// CHECK-NOELIDE-NOTREE: no matching function for call to 'set20'535// CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<const vector<int>>' to 'vector<const volatile vector<int>>' for 1st argument536// CHECK-ELIDE-TREE: no matching function for call to 'set20'537// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument538// CHECK-ELIDE-TREE:   vector<539// CHECK-ELIDE-TREE:     [const != const volatile] vector<...>>540// CHECK-NOELIDE-TREE: no matching function for call to 'set20'541// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument542// CHECK-NOELIDE-TREE:   vector<543// CHECK-NOELIDE-TREE:     [const != const volatile] vector<544// CHECK-NOELIDE-TREE:       int>>545 546 547// Checks that volatile does not show up in diagnostics.548template<typename T> struct S21 {};549template<typename T> using U21 = volatile S21<T>;550int f21(vector<const U21<int>>);551int k21 = f21(vector<U21<int>>());552// CHECK-ELIDE-NOTREE: no matching function for call to 'f21'553// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<U21<...>>' to 'vector<const U21<...>>' for 1st argument554// CHECK-NOELIDE-NOTREE: no matching function for call to 'f21'555// CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<U21<int>>' to 'vector<const U21<int>>' for 1st argument556// CHECK-ELIDE-TREE: no matching function for call to 'f21'557// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument558// CHECK-ELIDE-TREE:    vector<559// CHECK-ELIDE-TREE:      [(no qualifiers) != const] U21<...>>560// CHECK-NOELIDE-TREE: no matching function for call to 'f21'561// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument562// CHECK-NOELIDE-TREE:    vector<563// CHECK-NOELIDE-TREE:      [(no qualifiers) != const] U21<564// CHECK-NOELIDE-TREE:        int>>565 566// Checks that volatile does not show up in diagnostics.567template<typename T> struct S22 {};568template<typename T> using U22 = volatile S22<T>;569int f22(vector<volatile const U22<int>>);570int k22 = f22(vector<volatile U22<int>>());571// CHECK-ELIDE-NOTREE: no matching function for call to 'f22'572// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<U22<...>>' to 'vector<const U22<...>>' for 1st argument573// CHECK-NOELIDE-NOTREE: no matching function for call to 'f22'574// CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<U22<int>>' to 'vector<const U22<int>>' for 1st argument575// CHECK-ELIDE-TREE: no matching function for call to 'f22'576// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument577// CHECK-ELIDE-TREE:    vector<578// CHECK-ELIDE-TREE:      [(no qualifiers) != const] U22<...>>579// CHECK-NOELIDE-TREE: no matching function for call to 'f22'580// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument581// CHECK-NOELIDE-TREE:    vector<582// CHECK-NOELIDE-TREE:      [(no qualifiers) != const] U22<583// CHECK-NOELIDE-TREE:        int>>584 585// Testing qualifiers and typedefs.586template <class T> struct D23{};587template <class T> using C23 = D23<T>;588typedef const C23<int> B23;589template<class ...T> using A23 = B23;590 591void foo23(D23<A23<>> b) {}592void test23() {593  foo23(D23<D23<char>>());594  foo23(C23<char>());595}596 597// CHECK-ELIDE-NOTREE: no matching function for call to 'foo23'598// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'D23<D23<char>>' to 'D23<const D23<int>>' for 1st argument599// CHECK-ELIDE-NOTREE: no matching function for call to 'foo23'600// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'D23<char>' to 'D23<A23<>>' for 1st argument601// CHECK-NOELIDE-NOTREE: no matching function for call to 'foo23'602// CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'D23<D23<char>>' to 'D23<const D23<int>>' for 1st argument603// CHECK-NOELIDE-NOTREE: no matching function for call to 'foo23'604// CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'D23<char>' to 'D23<A23<>>' for 1st argument605// CHECK-ELIDE-TREE: no matching function for call to 'foo23'606// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument607// CHECK-ELIDE-TREE:   D23<608// CHECK-ELIDE-TREE:     [(no qualifiers) != const] D23<609// CHECK-ELIDE-TREE:       [char != int]>>610// CHECK-ELIDE-TREE: no matching function for call to 'foo23'611// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument612// CHECK-ELIDE-TREE:   D23<613// CHECK-ELIDE-TREE:     [char != A23<>]>614// CHECK-NOELIDE-TREE: no matching function for call to 'foo23'615// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument616// CHECK-NOELIDE-TREE:   D23<617// CHECK-NOELIDE-TREE:     [(no qualifiers) != const] D23<618// CHECK-NOELIDE-TREE:       [char != int]>>619// CHECK-NOELIDE-TREE: no matching function for call to 'foo23'620// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument621// CHECK-NOELIDE-TREE:   D23<622// CHECK-NOELIDE-TREE:     [char != A23<>]>623 624namespace PR14015 {625template <unsigned N> class Foo1 {};626template <unsigned N = 2> class Foo2 {};627template <unsigned ...N> class Foo3 {};628 629void Play1() {630  Foo1<1> F1;631  Foo1<2> F2, F3;632  F2 = F1;633  F1 = F2;634  F2 = F3;635  F3 = F2;636}637 638// CHECK-ELIDE-NOTREE: no viable overloaded '='639// CHECK-ELIDE-NOTREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from 'Foo1<1>' to 'const Foo1<2>' for 1st argument640// CHECK-ELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo1<1>' to 'Foo1<2>' for 1st argument641// CHECK-ELIDE-NOTREE: no viable overloaded '='642// CHECK-ELIDE-NOTREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from 'Foo1<2>' to 'const Foo1<1>' for 1st argument643// CHECK-ELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo1<2>' to 'Foo1<1>' for 1st argument644// CHECK-NOELIDE-NOTREE: no viable overloaded '='645// CHECK-NOELIDE-NOTREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from 'Foo1<1>' to 'const Foo1<2>' for 1st argument646// CHECK-NOELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo1<1>' to 'Foo1<2>' for 1st argument647// CHECK-NOELIDE-NOTREE: no viable overloaded '='648// CHECK-NOELIDE-NOTREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from 'Foo1<2>' to 'const Foo1<1>' for 1st argument649// CHECK-NOELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo1<2>' to 'Foo1<1>' for 1st argument650// CHECK-ELIDE-TREE: no viable overloaded '='651// CHECK-ELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument652// CHECK-ELIDE-TREE:   [(no qualifiers) != const] Foo1<653// CHECK-ELIDE-TREE:     [1 != 2]>654// CHECK-ELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument655// CHECK-ELIDE-TREE:   Foo1<656// CHECK-ELIDE-TREE:     [1 != 2]>657// CHECK-ELIDE-TREE: no viable overloaded '='658// CHECK-ELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument659// CHECK-ELIDE-TREE:   [(no qualifiers) != const] Foo1<660// CHECK-ELIDE-TREE:     [2 != 1]>661// CHECK-ELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument662// CHECK-ELIDE-TREE:   Foo1<663// CHECK-ELIDE-TREE:     [2 != 1]>664// CHECK-NOELIDE-TREE: no viable overloaded '='665// CHECK-NOELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument666// CHECK-NOELIDE-TREE:   [(no qualifiers) != const] Foo1<667// CHECK-NOELIDE-TREE:     [1 != 2]>668// CHECK-NOELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument669// CHECK-NOELIDE-TREE:   Foo1<670// CHECK-NOELIDE-TREE:     [1 != 2]>671// CHECK-NOELIDE-TREE: no viable overloaded '='672// CHECK-NOELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument673// CHECK-NOELIDE-TREE:   [(no qualifiers) != const] Foo1<674// CHECK-NOELIDE-TREE:     [2 != 1]>675// CHECK-NOELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument676// CHECK-NOELIDE-TREE:   Foo1<677// CHECK-NOELIDE-TREE:     [2 != 1]>678 679void Play2() {680  Foo2<1> F1;681  Foo2<> F2, F3;682  F2 = F1;683  F1 = F2;684  F2 = F3;685  F3 = F2;686}687// CHECK-ELIDE-NOTREE: no viable overloaded '='688// CHECK-ELIDE-NOTREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from 'Foo2<1>' to 'const Foo2<2>' for 1st argument689// CHECK-ELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo2<1>' to 'Foo2<2>' for 1st argument690// CHECK-ELIDE-NOTREE: no viable overloaded '='691// 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 argument692// CHECK-ELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo2<(default) 2>' to 'Foo2<1>' for 1st argument693// CHECK-NOELIDE-NOTREE: no viable overloaded '='694// CHECK-NOELIDE-NOTREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from 'Foo2<1>' to 'const Foo2<2>' for 1st argument695// CHECK-NOELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo2<1>' to 'Foo2<2>' for 1st argument696// CHECK-NOELIDE-NOTREE: no viable overloaded '='697// 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 argument698// CHECK-NOELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo2<(default) 2>' to 'Foo2<1>' for 1st argument699// CHECK-ELIDE-TREE: no viable overloaded '='700// CHECK-ELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument701// CHECK-ELIDE-TREE:   [(no qualifiers) != const] Foo2<702// CHECK-ELIDE-TREE:     [1 != 2]>703// CHECK-ELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument704// CHECK-ELIDE-TREE:   Foo2<705// CHECK-ELIDE-TREE:     [1 != 2]>706// CHECK-ELIDE-TREE: no viable overloaded '='707// CHECK-ELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument708// CHECK-ELIDE-TREE:   [(no qualifiers) != const] Foo2<709// CHECK-ELIDE-TREE:     [(default) 2 != 1]>710// CHECK-ELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument711// CHECK-ELIDE-TREE:   Foo2<712// CHECK-ELIDE-TREE:     [(default) 2 != 1]>713// CHECK-NOELIDE-TREE: no viable overloaded '='714// CHECK-NOELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument715// CHECK-NOELIDE-TREE:   [(no qualifiers) != const] Foo2<716// CHECK-NOELIDE-TREE:     [1 != 2]>717// CHECK-NOELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument718// CHECK-NOELIDE-TREE:   Foo2<719// CHECK-NOELIDE-TREE:     [1 != 2]>720// CHECK-NOELIDE-TREE: no viable overloaded '='721// CHECK-NOELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument722// CHECK-NOELIDE-TREE:   [(no qualifiers) != const] Foo2<723// CHECK-NOELIDE-TREE:     [(default) 2 != 1]>724// CHECK-NOELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument725// CHECK-NOELIDE-TREE:   Foo2<726// CHECK-NOELIDE-TREE:     [(default) 2 != 1]>727 728void Play3() {729  Foo3<1> F1;730  Foo3<2, 1> F2, F3;731  F2 = F1;732  F1 = F2;733  F2 = F3;734  F3 = F2;735}736// CHECK-ELIDE-NOTREE: no viable overloaded '='737// 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 argument738// 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 argument739// CHECK-ELIDE-NOTREE: no viable overloaded '='740// 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 argument741// 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 argument742// CHECK-NOELIDE-NOTREE: no viable overloaded '='743// 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 argument744// 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 argument745// CHECK-NOELIDE-NOTREE: no viable overloaded '='746// 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 argument747// 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 argument748// CHECK-ELIDE-TREE: no viable overloaded '='749// CHECK-ELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument750// CHECK-ELIDE-TREE:   [(no qualifiers) != const] Foo3<751// CHECK-ELIDE-TREE:     [1 != 2],752// CHECK-ELIDE-TREE:     [(no argument) != 1]>753// CHECK-ELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument754// CHECK-ELIDE-TREE:   Foo3<755// CHECK-ELIDE-TREE:     [1 != 2],756// CHECK-ELIDE-TREE:     [(no argument) != 1]>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 argument759// CHECK-ELIDE-TREE:   [(no qualifiers) != const] Foo3<760// CHECK-ELIDE-TREE:     [2 != 1],761// CHECK-ELIDE-TREE:     [1 != (no argument)]>762// CHECK-ELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument763// CHECK-ELIDE-TREE:   Foo3<764// CHECK-ELIDE-TREE:     [2 != 1],765// CHECK-ELIDE-TREE:     [1 != (no argument)]>766// CHECK-NOELIDE-TREE: no viable overloaded '='767// CHECK-NOELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument768// CHECK-NOELIDE-TREE:   [(no qualifiers) != const] Foo3<769// CHECK-NOELIDE-TREE:     [1 != 2],770// CHECK-NOELIDE-TREE:     [(no argument) != 1]>771// CHECK-NOELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument772// CHECK-NOELIDE-TREE:   Foo3<773// CHECK-NOELIDE-TREE:     [1 != 2],774// CHECK-NOELIDE-TREE:     [(no argument) != 1]>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 argument777// CHECK-NOELIDE-TREE:   [(no qualifiers) != const] Foo3<778// CHECK-NOELIDE-TREE:     [2 != 1],779// CHECK-NOELIDE-TREE:     [1 != (no argument)]>780// CHECK-NOELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument781// CHECK-NOELIDE-TREE:   Foo3<782// CHECK-NOELIDE-TREE:     [2 != 1],783// CHECK-NOELIDE-TREE:     [1 != (no argument)]>784}785 786namespace PR14342 {787  template<typename T, short a> struct X {};788  X<int, (signed char)-1> x = X<long, -1>();789  X<int, 3UL> y = X<int, 2>();790  // CHECK-ELIDE-NOTREE: error: no viable conversion from 'X<long, [...]>' to 'X<int, [...]>'791  // CHECK-ELIDE-NOTREE: error: no viable conversion from 'X<[...], 2>' to 'X<[...], 3>'792}793 794namespace PR14489 {795  // The important thing here is that the diagnostic diffs a template specialization796  // with no arguments against itself.  (We might need a different test if this797  // diagnostic changes).798  template<class ...V>799  struct VariableList   {800    void ConnectAllToAll(VariableList<>& params = VariableList<>())    {801    }802  };803  // CHECK-ELIDE-NOTREE: non-const lvalue reference to type 'VariableList<>' cannot bind to a temporary of type 'VariableList<>'804}805 806namespace rdar12456626 {807  struct IntWrapper {808    typedef int type;809  };810 811  template<typename T, typename T::type V>812  struct X { };813 814  struct A {815    virtual X<IntWrapper, 1> foo();816  };817 818  struct B : A {819    // CHECK-ELIDE-NOTREE: virtual function 'foo' has a different return type820    virtual X<IntWrapper, 2> foo();821  };822}823 824namespace PR15023 {825  // Don't crash when non-QualTypes are passed to a diff modifier.826  template <typename... Args>827  void func(void (*func)(Args...), Args...) { }828 829  void bar(int, int &) {830  }831 832  void foo(int x) {833    func(bar, 1, x)834  }835  // CHECK-ELIDE-NOTREE: no matching function for call to 'func'836  // CHECK-ELIDE-NOTREE: candidate template ignored: deduced conflicting types for parameter 'Args' (<int, int &> vs. <int, int>)837}838 839namespace rdar12931988 {840  namespace A {841    template<typename T> struct X { };842  }843 844  namespace B {845    template<typename T> struct X { };846  }847 848  void foo(A::X<int> &ax, B::X<int> bx) {849    // CHECK-ELIDE-NOTREE: no viable overloaded '='850    // CHECK-ELIDE-NOTREE: no known conversion from 'B::X<int>' to 'const X<int>'851    ax = bx;852  }853 854  template<template<typename> class> class Y {};855 856  void bar(Y<A::X> ya, Y<B::X> yb) {857    // CHECK-ELIDE-NOTREE: no viable overloaded '='858    // CHECK-ELIDE-NOTREE: no known conversion from 'Y<template rdar12931988::B::X>' to 'Y<template rdar12931988::A::X>'859    ya = yb;860  }861}862 863namespace ValueDecl {864  int int1, int2, default_int;865  template <const int& T = default_int>866  struct S {};867 868  typedef S<int1> T1;869  typedef S<int2> T2;870  typedef S<> TD;871 872  void test() {873    T1 t1;874    T2 t2;875    TD td;876 877    t1 = t2;878    // CHECK-ELIDE-NOTREE: no viable overloaded '='879    // CHECK-ELIDE-NOTREE: no known conversion from 'S<int2>' to 'S<int1>'880 881    t2 = t1;882    // CHECK-ELIDE-NOTREE: no viable overloaded '='883    // CHECK-ELIDE-NOTREE: no known conversion from 'S<int1>' to 'S<int2>'884 885    td = t1;886    // TODO: Find out why (default) isn't printed on second template.887    // CHECK-ELIDE-NOTREE: no viable overloaded '='888    // CHECK-ELIDE-NOTREE: no known conversion from 'S<int1>' to 'S<default_int>'889 890    t2 = td;891    // CHECK-ELIDE-NOTREE: no viable overloaded '='892    // CHECK-ELIDE-NOTREE: no known conversion from 'S<(default) default_int>' to 'S<int2>'893 894  }895}896 897namespace DependentDefault {898  template <typename> struct Trait {899    enum { V = 40 };900    typedef int Ty;901    static int I;902  };903  int other;904 905  template <typename T, int = Trait<T>::V > struct A {};906  template <typename T, typename = Trait<T>::Ty > struct B {};907  template <typename T, int& = Trait<T>::I > struct C {};908 909  void test() {910 911    A<int> a1;912    A<char> a2;913    A<int, 10> a3;914    a1 = a2;915    // CHECK-ELIDE-NOTREE: no viable overloaded '='916    // CHECK-ELIDE-NOTREE: no known conversion from 'A<char, [...]>' to 'A<int, [...]>'917    a3 = a1;918    // CHECK-ELIDE-NOTREE: no viable overloaded '='919    // CHECK-ELIDE-NOTREE: no known conversion from 'A<[...], (default) Trait<T>::V aka 40>' to 'A<[...], 10>'920    a2 = a3;921    // CHECK-ELIDE-NOTREE: no viable overloaded '='922    // CHECK-ELIDE-NOTREE: no known conversion from 'A<int, 10>' to 'A<char, 40>'923 924    B<int> b1;925    B<char> b2;926    B<int, char> b3;927    b1 = b2;928    // CHECK-ELIDE-NOTREE: no viable overloaded '='929    // CHECK-ELIDE-NOTREE: no known conversion from 'B<char, [...]>' to 'B<int, [...]>'930    b3 = b1;931    // CHECK-ELIDE-NOTREE: no viable overloaded '='932    // CHECK-ELIDE-NOTREE: no known conversion from 'B<[...], (default) int>' to 'B<[...], char>'933    b2 = b3;934    // CHECK-ELIDE-NOTREE: no viable overloaded '='935    // CHECK-ELIDE-NOTREE: no known conversion from 'B<int, char>' to 'B<char, int>'936 937    C<int> c1;938    C<char> c2;939    C<int, other> c3;940    c1 = c2;941    // CHECK-ELIDE-NOTREE: no viable overloaded '='942    // CHECK-ELIDE-NOTREE: no known conversion from 'C<char, (default) I>' to 'C<int, I>'943    c3 = c1;944    // CHECK-ELIDE-NOTREE: no viable overloaded '='945    // CHECK-ELIDE-NOTREE: no known conversion from 'C<[...], (default) I>' to 'C<[...], other>'946    c2 = c3;947    // CHECK-ELIDE-NOTREE: no viable overloaded '='948    // CHECK-ELIDE-NOTREE: no known conversion from 'C<int, other>' to 'C<char, I>'949  }950}951 952namespace VariadicDefault {953  int i1, i2, i3;954  template <int = 5, int...> struct A {};955  template <int& = i1, int& ...> struct B {};956  template <typename = void, typename...> struct C {};957 958  void test() {959    A<> a1;960    A<5, 6, 7> a2;961    A<1, 2> a3;962    a2 = a1;963    // CHECK-ELIDE-NOTREE: no viable overloaded '='964    // CHECK-ELIDE-NOTREE: no known conversion from 'A<[...], (no argument), (no argument)>' to 'A<[...], 6, 7>'965    a3 = a1;966    // CHECK-ELIDE-NOTREE: no viable overloaded '='967    // CHECK-ELIDE-NOTREE: no known conversion from 'A<(default) 5, (no argument)>' to 'A<1, 2>'968 969    B<> b1;970    B<i1, i2, i3> b2;971    B<i2, i3> b3;972    b2 = b1;973    // CHECK-ELIDE-NOTREE: no viable overloaded '='974    // CHECK-ELIDE-NOTREE: no known conversion from 'B<[...], (no argument), (no argument)>' to 'B<[...], i2, i3>'975    b3 = b1;976    // CHECK-ELIDE-NOTREE: no viable overloaded '='977    // CHECK-ELIDE-NOTREE: no known conversion from 'B<(default) i1, (no argument)>' to 'B<i2, i3>'978 979    B<i1, i2, i3> b4 = b1;980    // CHECK-ELIDE-NOTREE: no viable conversion from 'B<[...], (no argument), (no argument)>' to 'B<[...], i2, i3>'981    B<i2, i3> b5 = b1;982    // CHECK-ELIDE-NOTREE: no viable conversion from 'B<(default) i1, (no argument)>' to 'B<i2, i3>'983 984    C<> c1;985    C<void, void> c2;986    C<char, char> c3;987    c2 = c1;988    // CHECK-ELIDE-NOTREE: no viable overloaded '='989    // CHECK-ELIDE-NOTREE: no known conversion from 'C<[...], (no argument)>' to 'C<[...], void>'990    c3 = c1;991    // CHECK-ELIDE-NOTREE: no viable overloaded '='992    // CHECK-ELIDE-NOTREE: no known conversion from 'C<(default) void, (no argument)>' to 'C<char, char>'993  }994}995 996namespace PointerArguments {997  template <int *p> class T {};998  template <int* ...> class U {};999  int a, b, c;1000  int z[5];1001  void test() {1002    T<&a> ta;1003    T<z> tz;1004    T<&b> tb(ta);1005    // CHECK-ELIDE-NOTREE: no matching constructor for initialization of 'T<&b>'1006    // CHECK-ELIDE-NOTREE: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'T<&a>' to 'const T<&b>' for 1st argument1007    T<&c> tc(tz);1008    // CHECK-ELIDE-NOTREE: no matching constructor for initialization of 'T<&c>'1009    // CHECK-ELIDE-NOTREE: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'T<z>' to 'const T<&c>' for 1st argument1010 1011    U<&a, &a> uaa;1012    U<&b> ub(uaa);1013    // CHECK-ELIDE-NOTREE: no matching constructor for initialization of 'U<&b>'1014    // 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 argument1015 1016    U<&b, &b, &b> ubbb(uaa);1017    // CHECK-ELIDE-NOTREE: no matching constructor for initialization of 'U<&b, &b, &b>'1018    // 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 argument1019 1020  }1021}1022 1023namespace DependentInt {1024  template<int Num> struct INT;1025 1026  template <class CLASS, class Int_wrapper = INT<CLASS::val> >1027  struct C;1028 1029  struct N {1030    static const int val = 1;1031  };1032 1033  template <class M_T>1034  struct M {};1035 1036  void test() {1037    using T1 = M<C<int, INT<0>>>;1038    using T2 = M<C<N>>;1039    T2 p;1040    T1 x = p;1041    // CHECK-ELIDE-NOTREE: no viable conversion from 'M<C<N, INT<1>>>' to 'M<C<int, INT<0>>>'1042  }1043}1044 1045namespace PR17510 {1046class Atom;1047 1048template <typename T> class allocator;1049template <typename T, typename A> class vector;1050 1051typedef vector<const Atom *, allocator<const Atom *> > AtomVector;1052 1053template <typename T, typename A = allocator<const Atom *> > class vector {};1054 1055void foo() {1056  vector<Atom *> v;1057  AtomVector v2(v);1058  // CHECK-ELIDE-NOTREE: no known conversion from 'vector<Atom *, [...]>' to 'const vector<const PR17510::Atom *, [...]>'1059}1060}1061 1062namespace PR15677 {1063template <bool>1064struct A{};1065 1066template <typename T>1067using B = A<T::value>;1068 1069template <typename T>1070using B = A<!T::value>;1071// CHECK-ELIDE-NOTREE: type alias template redefinition with different types ('A<!T::value>' vs 'A<T::value>')1072 1073template <int>1074struct C{};1075 1076template <typename T>1077using D = C<T::value>;1078 1079template <typename T>1080using D = C<T::value + 1>;1081// CHECK-ELIDE-NOTREE: type alias template redefinition with different types ('C<T::value + 1>' vs 'C<T::value>')1082 1083template <typename T>1084using E = C<T::value>;1085 1086template <typename T>1087using E = C<42>;1088// CHECK-ELIDE-NOTREE: type alias template redefinition with different types ('C<42>' vs 'C<T::value>')1089 1090template <typename T>1091using F = C<T::value>;1092 1093template <typename T>1094using F = C<21 + 21>;1095// CHECK-ELIDE-NOTREE: type alias template redefinition with different types ('C<21 + 21 aka 42>' vs 'C<T::value>')1096}1097}1098 1099namespace AddressOf {1100template <int*>1101struct S {};1102 1103template <class T>1104struct Wrapper {};1105 1106template <class T>1107Wrapper<T> MakeWrapper();1108int global, global2;1109constexpr int * ptr = nullptr;1110Wrapper<S<ptr>> W = MakeWrapper<S<&global>>();1111// Don't print an extra '&' for 'ptr'1112// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global>>' to 'Wrapper<S<ptr aka nullptr>>'1113 1114// Handle parens correctly1115Wrapper<S<(&global2)>> W2 = MakeWrapper<S<&global>>();1116// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global>>' to 'Wrapper<S<&global2>>'1117Wrapper<S<&global2>> W3 = MakeWrapper<S<(&global)>>();1118// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global>>' to 'Wrapper<S<&global2>>'1119Wrapper<S<(&global2)>> W4 = MakeWrapper<S<(&global)>>();1120// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global>>' to 'Wrapper<S<&global2>>'1121}1122 1123namespace NullPtr {1124template <int*, int*>1125struct S {};1126 1127template <class T>1128struct Wrapper {};1129 1130template <class T>1131Wrapper<T> MakeWrapper();1132int global, global2;1133constexpr int * ptr = nullptr;1134constexpr int * ptr2 = static_cast<int*>(0);1135 1136S<&global> s1 = S<&global, ptr>();1137S<&global, nullptr> s2 = S<&global, ptr>();1138 1139S<&global, nullptr> s3 = S<&global, &global>();1140// CHECK-ELIDE-NOTREE: no viable conversion from 'S<[...], &global>' to 'S<[...], nullptr>'1141S<&global, ptr> s4 = S<&global, &global>();1142// CHECK-ELIDE-NOTREE: no viable conversion from 'S<[...], &global>' to 'S<[...], ptr aka nullptr>1143 1144Wrapper<S<&global, nullptr>> W1 = MakeWrapper<S<&global, ptr>>();1145Wrapper<S<&global, static_cast<int*>(0)>> W2 = MakeWrapper<S<&global, ptr>>();1146 1147Wrapper<S<&global, nullptr>> W3 = MakeWrapper<S<&global, &global>>();1148// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<[...], &global>>' to 'Wrapper<S<[...], nullptr>>'1149Wrapper<S<&global, ptr>> W4 = MakeWrapper<S<&global, &global>>();1150// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<[...], &global>>' to 'Wrapper<S<[...], ptr aka nullptr>>'1151 1152Wrapper<S<&global2, ptr>> W5 = MakeWrapper<S<&global, nullptr>>();1153// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global, [...]>>' to 'Wrapper<S<&global2, [...]>>'1154Wrapper<S<&global2, nullptr>> W6 = MakeWrapper<S<&global, nullptr>>();1155// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global, [...]>>' to 'Wrapper<S<&global2, [...]>>'1156Wrapper<S<&global2, ptr2>> W7 = MakeWrapper<S<&global, nullptr>>();1157// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global, [...]>>' to 'Wrapper<S<&global2, [...]>>'1158Wrapper<S<&global2, nullptr>> W8 = MakeWrapper<S<&global, ptr2>>();1159// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global, [...]>>' to 'Wrapper<S<&global2, [...]>>'1160Wrapper<S<&global2, ptr>> W9 = MakeWrapper<S<&global, ptr2>>();1161// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global, [...]>>' to 'Wrapper<S<&global2, [...]>>'1162Wrapper<S<&global2, ptr2>> W10 = MakeWrapper<S<&global, ptr>>();1163// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global, [...]>>' to 'Wrapper<S<&global2, [...]>>'1164Wrapper<S<&global2, static_cast<int *>(0)>> W11 =1165    MakeWrapper<S<&global, nullptr>>();1166// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global, [...]>>' to 'Wrapper<S<&global2, [...]>>'1167Wrapper<S<&global2, nullptr>> W12 =1168    MakeWrapper<S<&global, static_cast<int *>(0)>>();1169// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global, [...]>>' to 'Wrapper<S<&global2, [...]>>'1170 1171Wrapper<S<&global, &global>> W13 = MakeWrapper<S<&global, ptr>>();1172// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<[...], nullptr>>' to 'Wrapper<S<[...], &global>>'1173Wrapper<S<&global, ptr>> W14 = MakeWrapper<S<&global, &global>>();1174// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<[...], &global>>' to 'Wrapper<S<[...], ptr aka nullptr>>'1175}1176 1177namespace TemplateTemplateDefault {1178template <class> class A{};1179template <class> class B{};1180template <class> class C{};1181template <template <class> class, template <class> class = A>1182        class T {};1183 1184T<A> t1 = T<A, C>();1185// CHECK-ELIDE-NOTREE: no viable conversion from 'T<[...], template C>' to 'T<[...], (default) template A>'1186T<A, C> t2 = T<A>();1187// CHECK-ELIDE-NOTREE: no viable conversion from 'T<[...], (default) template A>' to 'T<[...], template C>'1188T<A> t3 = T<B>();1189// CHECK-ELIDE-NOTREE: no viable conversion from 'T<template B>' to 'T<template A>'1190T<B, C> t4 = T<C, B>();1191// CHECK-ELIDE-NOTREE: no viable conversion from 'T<template C, template B>' to 'T<template B, template C>'1192T<A, A> t5 = T<B>();1193// CHECK-ELIDE-NOTREE: no viable conversion from 'T<template B, [...]>' to 'T<template A, [...]>'1194T<B> t6 = T<A, A>();1195// CHECK-ELIDE-NOTREE: no viable conversion from 'T<template A, [...]>' to 'T<template B, [...]>'1196}1197 1198namespace Bool {1199template <class> class A{};1200A<bool> a1 = A<int>();1201// CHECK-ELIDE-NOTREE: no viable conversion from 'A<int>' to 'A<bool>'1202A<int> a2 = A<bool>();1203// CHECK-ELIDE-NOTREE: no viable conversion from 'A<bool>' to 'A<int>'1204}1205 1206namespace TypeAlias {1207template <int, int = 0> class A {};1208 1209template <class T> using a = A<T::num, 0>;1210template <class T> using a = A<T::num>;1211 1212template <class T> using A1 = A<T::num>;1213template <class T> using A1 = A<T::num + 0>;1214// CHECK-ELIDE-NOTREE: type alias template redefinition with different types ('A<T::num + 0>' vs 'A<T::num>')1215 1216template <class T> using A2 = A<1 + T::num>;1217template <class T> using A2 = A<T::num + 1>;1218// CHECK-ELIDE-NOTREE: type alias template redefinition with different types ('A<T::num + 1>' vs 'A<1 + T::num>')1219 1220template <class T> using A3 = A<(T::num)>;1221template <class T> using A3 = A<T::num>;1222// CHECK-ELIDE-NOTREE: error: type alias template redefinition with different types ('A<T::num>' vs 'A<(T::num)>')1223 1224          template <class T> using A4 = A<(T::num)>;1225template <class T> using A4 = A<((T::num))>;1226// CHECK-ELIDE-NOTREE: type alias template redefinition with different types ('A<((T::num))>' vs 'A<(T::num)>')1227 1228template <class T> using A5 = A<T::num, 1>;1229template <class T> using A5 = A<T::num>;1230// CHECK-ELIDE-NOTREE: type alias template redefinition with different types ('A<[...], (default) 0>' vs 'A<[...], 1>')1231 1232template <class T> using A6 = A<T::num + 5, 1>;1233template <class T> using A6 = A<T::num + 5>;1234// CHECK-ELIDE-NOTREE: type alias template redefinition with different types ('A<[...], (default) 0>' vs 'A<[...], 1>')1235 1236template <class T> using A7 = A<T::num, 1>;1237template <class T> using A7 = A<(T::num)>;1238// CHECK-ELIDE-NOTREE: type alias template redefinition with different types ('A<(T::num), (default) 0>' vs 'A<T::num, 1>')1239}1240 1241namespace TemplateArgumentImplicitConversion {1242template <int X> struct condition {};1243 1244struct is_const {1245    constexpr operator int() const { return 10; }1246};1247 1248using T = condition<(is_const())>;1249void foo(const T &t) {1250  T &t2 = t;1251}1252// CHECK-ELIDE-NOTREE: binding reference of type 'condition<...>' to value of type 'const condition<...>' drops 'const' qualifier1253}1254 1255namespace BoolArgumentBitExtended {1256template <bool B> struct BoolT {};1257 1258template <typename T> void foo(T) {}1259 1260void test() {1261  BoolT<false> X;1262  foo<BoolT<true>>(X);1263}1264// CHECK-ELIDE-NOTREE: no matching function for call to 'foo'1265// CHECK-ELIDE-NOTREE: candidate function template not viable: no known conversion from 'BoolT<false>' to 'BoolT<true>' for 1st argument1266}1267 1268namespace DifferentIntegralTypes {1269template<typename T, T n>1270class A{};1271void foo() {1272  A<int, 1> a1 = A<long long, 1>();1273  A<unsigned int, 1> a2 = A<int, 5>();1274  A<bool, true> a3 = A<signed char, true>();1275}1276// CHECK-ELIDE-NOTREE: error: no viable conversion from 'A<long long, (long long) 1>' to 'A<int, (int) 1>'1277// CHECK-ELIDE-NOTREE: error: no viable conversion from 'A<int, (int) 5>' to 'A<unsigned int, (unsigned int) 1>'1278// CHECK-ELIDE-NOTREE: error: no viable conversion from 'A<signed char, (signed char) 1>' to 'A<bool, (bool) true>'1279}1280 1281namespace MixedDeclarationIntegerArgument {1282template<typename T, T n> class A{};1283int x;1284int y[5];1285 1286A<int, 5> a1 = A<int&, x>();1287A<int, 5 - 1> a2 = A<int*, &x>();1288A<int, 5 + 1> a3 = A<int*, y>();1289A<int, 0> a4 = A<int**, nullptr>();1290// CHECK-ELIDE-NOTREE: error: no viable conversion from 'A<int &, x>' to 'A<int, 5>'1291// CHECK-ELIDE-NOTREE: error: no viable conversion from 'A<int *, &x>' to 'A<int, 5 - 1 aka 4>'1292// CHECK-ELIDE-NOTREE: error: no viable conversion from 'A<int *, y>' to 'A<int, 5 + 1 aka 6>'1293// CHECK-ELIDE-NOTREE: error: no viable conversion from 'A<int **, nullptr>' to 'A<int, 0>'1294// CHECK-ELIDE-TREE: error: no viable conversion1295// CHECK-ELIDE-TREE:   A<1296// CHECK-ELIDE-TREE:     [int & != int],1297// CHECK-ELIDE-TREE:     [x != 5]>1298// CHECK-ELIDE-TREE: error: no viable conversion1299// CHECK-ELIDE-TREE:   A<1300// CHECK-ELIDE-TREE:     [int * != int],1301// CHECK-ELIDE-TREE:     [&x != 5 - 1 aka 4]>1302// CHECK-ELIDE-TREE: error: no viable conversion1303// CHECK-ELIDE-TREE:   A<1304// CHECK-ELIDE-TREE:     [int * != int],1305// CHECK-ELIDE-TREE:     [y != 5 + 1 aka 6]>1306// CHECK-ELIDE-TREE: error: no viable conversion1307// CHECK-ELIDE-TREE:   A<1308// CHECK-ELIDE-TREE:     [int ** != int],1309// CHECK-ELIDE-TREE:     [nullptr != 0]>1310 1311A<int&, x> a5 = A<int, 3>();1312A<int*, &x> a6 = A<int, 3 - 1>();1313A<int*, y> a7 = A<int, 3 + 1>();1314A<int**, nullptr> a8 = A<int, 3>();1315// CHECK-ELIDE-NOTREE: error: no viable conversion from 'A<int, 3>' to 'A<int &, x>'1316// CHECK-ELIDE-NOTREE: error: no viable conversion from 'A<int, 3 - 1 aka 2>' to 'A<int *, &x>'1317// CHECK-ELIDE-NOTREE: error: no viable conversion from 'A<int, 3 + 1 aka 4>' to 'A<int *, y>'1318// CHECK-ELIDE-NOTREE: error: no viable conversion from 'A<int, 3>' to 'A<int **, nullptr>'1319// CHECK-ELIDE-TREE: error: no viable conversion1320// CHECK-ELIDE-TREE:   A<1321// CHECK-ELIDE-TREE:     [int != int &],1322// CHECK-ELIDE-TREE:     [3 != x]>1323// CHECK-ELIDE-TREE: error: no viable conversion1324// CHECK-ELIDE-TREE:   A<1325// CHECK-ELIDE-TREE:     [int != int *],1326// CHECK-ELIDE-TREE:     [3 - 1 aka 2 != &x]>1327// CHECK-ELIDE-TREE: error: no viable conversion1328// CHECK-ELIDE-TREE:   A<1329// CHECK-ELIDE-TREE:     [int != int *],1330// CHECK-ELIDE-TREE:     [3 + 1 aka 4 != y]>1331// CHECK-ELIDE-TREE: error: no viable conversion1332// CHECK-ELIDE-TREE:   A<1333// CHECK-ELIDE-TREE:     [int != int **],1334// CHECK-ELIDE-TREE:     [3 != nullptr]>1335 1336template<class T, T n = x> class B{} ;1337B<int, 5> b1 = B<int&>();1338// CHECK-ELIDE-NOTREE: error: no viable conversion from 'B<int &, (default) x>' to 'B<int, 5>'1339// CHECK-ELIDE-TREE: error: no viable conversion1340// CHECK-ELIDE-TREE:   B<1341// CHECK-ELIDE-TREE:     [int & != int],1342// CHECK-ELIDE-TREE:     [(default) x != 5]>1343 1344B<int &> b2 = B<int, 2>();1345// CHECK-ELIDE-NOTREE: error: no viable conversion from 'B<int, 2>' to 'B<int &, (default) x>'1346// CHECK-ELIDE-TREE:   B<1347// CHECK-ELIDE-TREE:     [int != int &],1348// CHECK-ELIDE-TREE:     [2 != (default) x]>1349 1350template<class T, T n = 11> class C {};1351C<int> c1 = C<int&, x>();1352// CHECK-ELIDE-NOTREE: error: no viable conversion from 'C<int &, x>' to 'C<int, (default) 11>'1353// CHECK-ELIDE-TREE: error: no viable conversion1354// CHECK-ELIDE-TREE:   C<1355// CHECK-ELIDE-TREE:     [int & != int],1356// CHECK-ELIDE-TREE:     [x != (default) 11]>1357 1358C<int &, x> c2 = C<int>();1359// CHECK-ELIDE-NOTREE: error: no viable conversion from 'C<int, (default) 11>' to 'C<int &, x>'1360// CHECK-ELIDE-TREE:   C<1361// CHECK-ELIDE-TREE:     [int != int &],1362// CHECK-ELIDE-TREE:     [(default) 11 != x]>1363}1364 1365namespace default_args {1366  template <int x, int y = 1+1, int z = 2>1367  class A {};1368 1369  void foo(A<0> &M) {1370    // CHECK-ELIDE-NOTREE: no viable conversion from 'A<[...], (default) 1 + 1 aka 2, (default) 2>' to 'A<[...], 0, 0>'1371    A<0, 0, 0> N = M;1372 1373    // CHECK-ELIDE-NOTREE: no viable conversion from 'A<[2 * ...], (default) 2>' to 'A<[2 * ...], 0>'1374    A<0, 2, 0> N2 = M;1375  }1376}1377 1378namespace DefaultNonTypeArgWithDependentType {1379// We used to crash diffing integer template arguments when the argument type1380// is dependent and default arguments were used.1381template <typename SizeType = int, SizeType = 0> struct A {};1382template <typename R = A<>> R bar();1383A<> &foo() { return bar(); }1384// CHECK-ELIDE-NOTREE: error: non-const lvalue reference to type 'A<...>' cannot bind to a temporary of type 'A<...>'1385// CHECK-NOELIDE-NOTREE: error: non-const lvalue reference to type 'A<int, 0>' cannot bind to a temporary of type 'A<int, 0>'1386}1387 1388namespace PR24587 {1389template <typename T, T v>1390struct integral_constant {};1391 1392auto false_ = integral_constant<bool, false> {};1393 1394template <typename T>1395void f(T, decltype(false_));1396 1397void run() {1398  f(1, integral_constant<bool, true>{});1399}1400// CHECK-ELIDE-NOTREE: error: no matching function for call to 'f'1401// CHECK-ELIDE-NOTREE: note: candidate function template not viable: no known conversion from 'integral_constant<[...], true>' to 'integral_constant<[...], false>' for 2nd argument1402}1403 1404namespace ZeroArgs {1405template <int N = 0> class A {};1406template <class T = A<>> class B {};1407A<1> a1 = A<>();1408A<> a2 = A<1>();1409B<> b1 = B<int>();1410B<int> b2 = B<>();1411B<> b3 = B<const A<>>();1412B<const A<>> b4 = B<>();1413// CHECK-ELIDE-NOTREE: error: no viable conversion from 'A<(default) 0>' to 'A<1>'1414// CHECK-ELIDE-NOTREE: error: no viable conversion from 'A<1>' to 'A<(default) 0>'1415// CHECK-ELIDE-NOTREE: error: no viable conversion from 'B<int>' to 'B<(default) ZeroArgs::A<>>'1416// CHECK-ELIDE-NOTREE: error: no viable conversion from 'B<(default) ZeroArgs::A<>>' to 'B<int>'1417// CHECK-ELIDE-NOTREE: error: no viable conversion from 'B<const A<...>>' to 'B<A<...>>'1418// CHECK-ELIDE-NOTREE: error: no viable conversion from 'B<A<...>>' to 'B<const A<...>>'1419}1420 1421namespace TypeAlias {1422 1423template <typename T> class vector {};1424 1425template <int Dimension> class Point;1426template <int dimension, typename T> using Polygon = vector<Point<dimension>>;1427 1428void foo(Polygon<3, float>);1429void bar() { foo(Polygon<2, float>()); }1430 1431// CHECK-ELIDE-NOTREE: error: no matching function for call to 'foo'1432// CHECK-ELIDE-NOTREE: note: candidate function not viable: no known conversion from 'Polygon<2, [...]>' to 'Polygon<3, [...]>' for 1st argument1433 1434enum class X {1435  X1,1436  X2,1437};1438 1439template<X x> struct EnumToType;1440 1441template <> struct EnumToType<X::X1> { using type = int; };1442 1443template <> struct EnumToType<X::X2> { using type = double; };1444 1445 1446template <X x> using VectorType = vector<typename EnumToType<x>::type>;1447 1448template <X x> void D(const VectorType<x>&);1449 1450void run() {1451  D<X::X1>(VectorType<X::X2>());1452}1453// CHECK-ELIDE-NOTREE: error: no matching function for call to 'D'1454// CHECK-ELIDE-NOTREE: note: candidate function template not viable: no known conversion from 'VectorType<X::X2>' to 'const VectorType<(X)0>' for 1st argument1455}1456 1457namespace TypeAlias2 {1458template <typename T>1459class A {};1460 1461template <typename T>1462using A_reg = A<T>;1463void take_reg(A_reg<int>);1464 1465template <typename T>1466using A_ptr = A<T> *;1467void take_ptr(A_ptr<int>);1468 1469template <typename T>1470using A_ref = const A<T> &;1471void take_ref(A_ref<int>);1472 1473void run(A_reg<float> reg, A_ptr<float> ptr, A_ref<float> ref) {1474  take_reg(reg);1475// CHECK-ELIDE-NOTREE: error: no matching function for call to 'take_reg'1476// CHECK-ELIDE-NOTREE: note:     candidate function not viable: no known conversion from 'A_reg<float>' to 'A_reg<int>' for 1st argument1477 1478  take_ptr(ptr);1479// CHECK-ELIDE-NOTREE: error: no matching function for call to 'take_ptr'1480// CHECK-ELIDE-NOTREE: note:     candidate function not viable: no known conversion from 'A_ptr<float>' to 'A_ptr<int>' for 1st argument1481 1482  take_ref(ref);1483// CHECK-ELIDE-NOTREE: error: no matching function for call to 'take_ref'1484// CHECK-ELIDE-NOTREE: note: candidate function not viable: no known conversion from 'const A<float>' to 'const A<int>' for 1st argument1485}1486}1487 1488namespace SubstTemplateTypeParmType {1489template <typename T>1490class Array {};1491 1492template <class T>1493class S {};1494 1495template <class T>1496Array<T> Make();1497 1498void Call() {1499  Array<S<int>> v = Make<const S<int>>();1500}1501}1502 1503// CHECK-ELIDE-NOTREE: no viable conversion from 'Array<const S<...>>' to 'Array<S<...>>'1504// CHECK-NOELIDE-NOTREE: no viable conversion from 'Array<const S<int>>' to 'Array<S<int>>'1505// CHECK-ELIDE-TREE: no viable conversion1506// CHECK-ELIDE-TREE:   Array<1507// CHECK-ELIDE-TREE:     [const != (no qualifiers)] S<...>>1508// CHECK-NOELIDE-TREE: no viable conversion1509// CHECK-NOELIDE-TREE:   Array<1510// CHECK-NOELIDE-TREE:     [const != (no qualifiers)] S<1511// CHECK-NOELIDE-TREE:       int>>1512}1513 1514// CHECK-ELIDE-NOTREE: {{[0-9]*}} errors generated.1515// CHECK-NOELIDE-NOTREE: {{[0-9]*}} errors generated.1516// CHECK-ELIDE-TREE: {{[0-9]*}} errors generated.1517// CHECK-NOELIDE-TREE: {{[0-9]*}} errors generated.1518 1519namespace pr30831 {1520  template <typename T> struct A { static A<T> const a; };1521  template <typename T> A<T> A<T>::a = A<T>();1522}1523