Home | History | Annotate | Download | only in Misc
      1 // RUN: not %clang_cc1 -fsyntax-only %s -std=c++11 2>&1 | FileCheck %s -check-prefix=CHECK-ELIDE-NOTREE
      2 // RUN: not %clang_cc1 -fsyntax-only %s -fno-elide-type -std=c++11 2>&1 | FileCheck %s -check-prefix=CHECK-NOELIDE-NOTREE
      3 // RUN: not %clang_cc1 -fsyntax-only %s -fdiagnostics-show-template-tree -std=c++11 2>&1 | FileCheck %s -check-prefix=CHECK-ELIDE-TREE
      4 // RUN: not %clang_cc1 -fsyntax-only %s -fno-elide-type -fdiagnostics-show-template-tree -std=c++11 2>&1 | FileCheck %s -check-prefix=CHECK-NOELIDE-TREE
      5 
      6 // PR9548 - "no known conversion from 'vector<string>' to 'vector<string>'"
      7 // vector<string> refers to two different types here.  Make sure the message
      8 // gives a way to tell them apart.
      9 class versa_string;
     10 typedef versa_string string;
     11 
     12 namespace std {template <typename T> class vector;}
     13 using std::vector;
     14 
     15 void f(vector<string> v);
     16 
     17 namespace std {
     18   class basic_string;
     19   typedef basic_string string;
     20   template <typename T> class vector {};
     21   void g() {
     22     vector<string> v;
     23     f(v);
     24   }
     25 } // end namespace std
     26 // CHECK-ELIDE-NOTREE: no matching function for call to 'f'
     27 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<std::basic_string>' to 'vector<versa_string>' for 1st argument
     28 // CHECK-NOELIDE-NOTREE: no matching function for call to 'f'
     29 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<std::basic_string>' to 'vector<versa_string>' for 1st argument
     30 // CHECK-ELIDE-TREE: no matching function for call to 'f'
     31 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
     32 // CHECK-ELIDE-TREE:   vector<
     33 // CHECK-ELIDE-TREE:     [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 argument
     36 // CHECK-NOELIDE-TREE:   vector<
     37 // CHECK-NOELIDE-TREE:     [std::basic_string != versa_string]>
     38 
     39 template <int... A>
     40 class I1{};
     41 void set1(I1<1,2,3,4,2,3,4,3>) {};
     42 void test1() {
     43   set1(I1<1,2,3,4,2,2,4,3,7>());
     44 }
     45 // CHECK-ELIDE-NOTREE: no matching function for call to 'set1'
     46 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'I1<[5 * ...], 2, [2 * ...], 7>' to 'I1<[5 * ...], 3, [2 * ...], (no argument)>' for 1st argument
     47 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set1'
     48 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'I1<1, 2, 3, 4, 2, 2, 4, 3, 7>' to 'I1<1, 2, 3, 4, 2, 3, 4, 3, (no argument)>' for 1st argument
     49 // CHECK-ELIDE-TREE: no matching function for call to 'set1'
     50 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
     51 // CHECK-ELIDE-TREE:   I1<
     52 // CHECK-ELIDE-TREE:     [5 * ...],
     53 // CHECK-ELIDE-TREE:     [2 != 3],
     54 // CHECK-ELIDE-TREE:     [2 * ...],
     55 // CHECK-ELIDE-TREE:     [7 != (no argument)]>
     56 // CHECK-NOELIDE-TREE: no matching function for call to 'set1'
     57 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
     58 // CHECK-NOELIDE-TREE:   I1<
     59 // CHECK-NOELIDE-TREE:     1,
     60 // CHECK-NOELIDE-TREE:     2,
     61 // CHECK-NOELIDE-TREE:     3,
     62 // CHECK-NOELIDE-TREE:     4,
     63 // CHECK-NOELIDE-TREE:     2,
     64 // CHECK-NOELIDE-TREE:     [2 != 3],
     65 // CHECK-NOELIDE-TREE:     4,
     66 // CHECK-NOELIDE-TREE:     3,
     67 // CHECK-NOELIDE-TREE:     [7 != (no argument)]>
     68 
     69 template <class A, class B, class C = void>
     70 class I2{};
     71 void set2(I2<int, int>) {};
     72 void test2() {
     73   set2(I2<double, int, int>());
     74 }
     75 // CHECK-ELIDE-NOTREE: no matching function for call to 'set2'
     76 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'I2<double, [...], int>' to 'I2<int, [...], (default) void>' for 1st argument
     77 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set2'
     78 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'I2<double, int, int>' to 'I2<int, int, (default) void>' for 1st argument
     79 // CHECK-ELIDE-TREE: no matching function for call to 'set2'
     80 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
     81 // CHECK-ELIDE-TREE:   I2<
     82 // CHECK-ELIDE-TREE:     [double != int],
     83 // CHECK-ELIDE-TREE:     [...],
     84 // CHECK-ELIDE-TREE:     [int != (default) void]>
     85 // CHECK-NOELIDE-TREE: no matching function for call to 'set2'
     86 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
     87 // CHECK-NOELIDE-TREE:   I2<
     88 // CHECK-NOELIDE-TREE:     [double != int],
     89 // CHECK-NOELIDE-TREE:     int,
     90 // CHECK-NOELIDE-TREE:     [int != (default) void]>
     91 
     92 int V1, V2, V3;
     93 template <int* A, int *B>
     94 class I3{};
     95 void set3(I3<&V1, &V2>) {};
     96 void test3() {
     97   set3(I3<&V3, &V2>());
     98 }
     99 // CHECK-ELIDE-NOTREE: no matching function for call to 'set3'
    100 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'I3<&V3, [...]>' to 'I3<&V1, [...]>' for 1st argument
    101 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set3'
    102 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'I3<&V3, &V2>' to 'I3<&V1, &V2>' for 1st argument
    103 // CHECK-ELIDE-TREE: no matching function for call to 'set3'
    104 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    105 // CHECK-ELIDE-TREE:   I3<
    106 // CHECK-ELIDE-TREE:     [&V3 != &V1]
    107 // CHECK-ELIDE-TREE:     [...]>
    108 // CHECK-NOELIDE-TREE: no matching function for call to 'set3'
    109 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    110 // CHECK-NOELIDE-TREE:   I3<
    111 // CHECK-NOELIDE-TREE:     [&V3 != &V1]
    112 // CHECK-NOELIDE-TREE:     &V2>
    113 
    114 template <class A, class B>
    115 class Alpha{};
    116 template <class A, class B>
    117 class Beta{};
    118 template <class A, class B>
    119 class Gamma{};
    120 template <class A, class B>
    121 class Delta{};
    122 
    123 void set4(Alpha<int, int>);
    124 void test4() {
    125   set4(Beta<void, void>());
    126 }
    127 // CHECK-ELIDE-NOTREE: no matching function for call to 'set4'
    128 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'Beta<void, void>' to 'Alpha<int, int>' for 1st argument
    129 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set4'
    130 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'Beta<void, void>' to 'Alpha<int, int>' for 1st argument
    131 // CHECK-ELIDE-TREE: no matching function for call to 'set4'
    132 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from 'Beta<void, void>' to 'Alpha<int, int>' for 1st argument
    133 // CHECK-NOELIDE-TREE: no matching function for call to 'set4'
    134 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from 'Beta<void, void>' to 'Alpha<int, int>' for 1st argument
    135 
    136 void set5(Alpha<Beta<Gamma<Delta<int, int>, int>, int>, int>);
    137 void test5() {
    138   set5(Alpha<Beta<Gamma<void, void>, double>, double>());
    139 }
    140 // CHECK-ELIDE-NOTREE: no matching function for call to 'set5'
    141 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'Alpha<Beta<Gamma<void, void>, double>, double>' to 'Alpha<Beta<Gamma<Delta<int, int>, int>, int>, int>' for 1st argument
    142 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set5'
    143 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'Alpha<Beta<Gamma<void, void>, double>, double>' to 'Alpha<Beta<Gamma<Delta<int, int>, int>, int>, int>' for 1st argument
    144 // CHECK-ELIDE-TREE: no matching function for call to 'set5'
    145 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    146 // CHECK-ELIDE-TREE:   Alpha<
    147 // CHECK-ELIDE-TREE:     Beta<
    148 // CHECK-ELIDE-TREE:       Gamma<
    149 // CHECK-ELIDE-TREE:         [void != Delta<int, int>],
    150 // CHECK-ELIDE-TREE:         [void != int]>
    151 // CHECK-ELIDE-TREE:       [double != int]>
    152 // CHECK-ELIDE-TREE:     [double != int]>
    153 // CHECK-NOELIDE-TREE: no matching function for call to 'set5'
    154 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    155 // CHECK-NOELIDE-TREE:   Alpha<
    156 // CHECK-NOELIDE-TREE:     Beta<
    157 // CHECK-NOELIDE-TREE:       Gamma<
    158 // CHECK-NOELIDE-TREE:         [void != Delta<int, int>],
    159 // CHECK-NOELIDE-TREE:         [void != int]>
    160 // CHECK-NOELIDE-TREE:       [double != int]>
    161 // CHECK-NOELIDE-TREE:     [double != int]>
    162 
    163 void test6() {
    164   set5(Alpha<Beta<Delta<int, int>, int>, int>());
    165 }
    166 // CHECK-ELIDE-NOTREE: no matching function for call to 'set5'
    167 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'Alpha<Beta<Delta<int, int>, [...]>, [...]>' to 'Alpha<Beta<Gamma<Delta<int, int>, int>, [...]>, [...]>' for 1st argument
    168 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set5'
    169 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'Alpha<Beta<Delta<int, int>, int>, int>' to 'Alpha<Beta<Gamma<Delta<int, int>, int>, int>, int>' for 1st argument
    170 // CHECK-ELIDE-TREE: no matching function for call to 'set5'
    171 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    172 // CHECK-ELIDE-TREE:   Alpha<
    173 // CHECK-ELIDE-TREE:     Beta<
    174 // CHECK-ELIDE-TREE:       [Delta<int, int> != Gamma<Delta<int, int>, int>],
    175 // CHECK-ELIDE-TREE:       [...]>
    176 // CHECK-ELIDE-TREE:     [...]>
    177 // CHECK-NOELIDE-TREE: no matching function for call to 'set5'
    178 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    179 // CHECK-NOELIDE-TREE:   Alpha<
    180 // CHECK-NOELIDE-TREE:     Beta<
    181 // CHECK-NOELIDE-TREE:       [Delta<int, int> != Gamma<Delta<int, int>, int>],
    182 // CHECK-NOELIDE-TREE:       int>
    183 // CHECK-NOELIDE-TREE:     int>
    184 
    185 int a7, b7;
    186 int c7[] = {1,2,3};
    187 template<int *A>
    188 class class7 {};
    189 void set7(class7<&a7> A) {}
    190 void test7() {
    191   set7(class7<&a7>());
    192   set7(class7<&b7>());
    193   set7(class7<c7>());
    194   set7(class7<nullptr>());
    195 }
    196 // CHECK-ELIDE-NOTREE: no matching function for call to 'set7'
    197 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class7<&b7>' to 'class7<&a7>' for 1st argument
    198 // CHECK-ELIDE-NOTREE: no matching function for call to 'set7'
    199 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class7<c7>' to 'class7<&a7>' for 1st argument
    200 // CHECK-ELIDE-NOTREE: no matching function for call to 'set7'
    201 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class7<nullptr>' to 'class7<&a7>' for 1st argument
    202 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set7'
    203 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class7<&b7>' to 'class7<&a7>' for 1st argument
    204 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set7'
    205 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class7<c7>' to 'class7<&a7>' for 1st argument
    206 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set7'
    207 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class7<nullptr>' to 'class7<&a7>' for 1st argument
    208 // CHECK-ELIDE-TREE: no matching function for call to 'set7'
    209 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    210 // CHECK-ELIDE-TREE:   class7<
    211 // CHECK-ELIDE-TREE:     [&b7 != &a7]>
    212 // CHECK-ELIDE-TREE: no matching function for call to 'set7'
    213 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    214 // CHECK-ELIDE-TREE:   class7<
    215 // CHECK-ELIDE-TREE:     [c7 != &a7]>
    216 // CHECK-ELIDE-TREE: no matching function for call to 'set7'
    217 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    218 // CHECK-ELIDE-TREE:   class7<
    219 // CHECK-ELIDE-TREE:     [nullptr != &a7]>
    220 // CHECK-NOELIDE-TREE: no matching function for call to 'set7'
    221 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    222 // CHECK-NOELIDE-TREE:   class7<
    223 // CHECK-NOELIDE-TREE:     [&b7 != &a7]>
    224 // CHECK-NOELIDE-TREE: no matching function for call to 'set7'
    225 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    226 // CHECK-NOELIDE-TREE:   class7<
    227 // CHECK-NOELIDE-TREE:     [c7 != &a7]>
    228 // CHECK-NOELIDE-TREE: no matching function for call to 'set7'
    229 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    230 // CHECK-NOELIDE-TREE:   class7<
    231 // CHECK-NOELIDE-TREE:     [nullptr != &a7]>
    232 
    233 template<typename ...T> struct S8 {};
    234 template<typename T> using U8 = S8<int, char, T>;
    235 int f8(S8<int, char, double>);
    236 int k8 = f8(U8<char>());
    237 // CHECK-ELIDE-NOTREE: no matching function for call to 'f8'
    238 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'S8<[2 * ...], char>' to 'S8<[2 * ...], double>' for 1st argument
    239 // CHECK-NOELIDE-NOTREE: no matching function for call to 'f8'
    240 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'S8<int, char, char>' to 'S8<int, char, double>' for 1st argument
    241 // CHECK-ELIDE-TREE: no matching function for call to 'f8'
    242 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    243 // CHECK-ELIDE-TREE:   S8<
    244 // CHECK-ELIDE-TREE:     [2 * ...],
    245 // CHECK-ELIDE-TREE:     [char != double]>
    246 // CHECK-NOELIDE-TREE: no matching function for call to 'f8'
    247 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    248 // CHECK-NOELIDE-TREE:   S8<
    249 // CHECK-NOELIDE-TREE:     int,
    250 // CHECK-NOELIDE-TREE:     char,
    251 // CHECK-NOELIDE-TREE:     [char != double]>
    252 
    253 template<typename ...T> struct S9 {};
    254 template<typename T> using U9 = S9<int, char, T>;
    255 template<typename T> using V9 = U9<U9<T>>;
    256 int f9(S9<int, char, U9<const double>>);
    257 int k9 = f9(V9<double>());
    258 
    259 // CHECK-ELIDE-NOTREE: no matching function for call to 'f9'
    260 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'S9<[2 * ...], S9<[2 * ...], double>>' to 'S9<[2 * ...], S9<[2 * ...], const double>>' for 1st argument
    261 // CHECK-NOELIDE-NOTREE: no matching function for call to 'f9'
    262 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'S9<int, char, S9<int, char, double>>' to 'S9<int, char, S9<int, char, const double>>' for 1st argument
    263 // CHECK-ELIDE-TREE: no matching function for call to 'f9'
    264 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    265 // CHECK-ELIDE-TREE:   S9<
    266 // CHECK-ELIDE-TREE:     [2 * ...],
    267 // CHECK-ELIDE-TREE:     S9<
    268 // CHECK-ELIDE-TREE:       [2 * ...],
    269 // CHECK-ELIDE-TREE:       [double != const double]>>
    270 // CHECK-NOELIDE-TREE: no matching function for call to 'f9'
    271 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    272 // CHECK-NOELIDE-TREE:   S9<
    273 // CHECK-NOELIDE-TREE:     int,
    274 // CHECK-NOELIDE-TREE:     char,
    275 // CHECK-NOELIDE-TREE:     S9<
    276 // CHECK-NOELIDE-TREE:       int,
    277 // CHECK-NOELIDE-TREE:       char,
    278 // CHECK-NOELIDE-TREE:       [double != const double]>>
    279 
    280 template<typename ...A> class class_types {};
    281 void set10(class_types<int, int>) {}
    282 void test10() {
    283   set10(class_types<int>());
    284   set10(class_types<int, int, int>());
    285 }
    286 
    287 // CHECK-ELIDE-NOTREE: no matching function for call to 'set10'
    288 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class_types<[...], (no argument)>' to 'class_types<[...], int>' for 1st argument
    289 // CHECK-ELIDE-NOTREE: no matching function for call to 'set10'
    290 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class_types<[2 * ...], int>' to 'class_types<[2 * ...], (no argument)>' for 1st argument
    291 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set10'
    292 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class_types<int, (no argument)>' to 'class_types<int, int>' for 1st argument
    293 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set10'
    294 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class_types<int, int, int>' to 'class_types<int, int, (no argument)>' for 1st argument
    295 // CHECK-ELIDE-TREE: no matching function for call to 'set10'
    296 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    297 // CHECK-ELIDE-TREE:   class_types<
    298 // CHECK-ELIDE-TREE:     [...],
    299 // CHECK-ELIDE-TREE:     [(no argument) != int]>
    300 // CHECK-ELIDE-TREE: no matching function for call to 'set10'
    301 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    302 // CHECK-ELIDE-TREE:   class_types<
    303 // CHECK-ELIDE-TREE:     [2 * ...],
    304 // CHECK-ELIDE-TREE:     [int != (no argument)]>
    305 // CHECK-NOELIDE-TREE: no matching function for call to 'set10'
    306 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    307 // CHECK-NOELIDE-TREE:   class_types<
    308 // CHECK-NOELIDE-TREE:     int,
    309 // CHECK-NOELIDE-TREE:     [(no argument) != int]>
    310 // CHECK-NOELIDE-TREE: no matching function for call to 'set10'
    311 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    312 // CHECK-NOELIDE-TREE:   class_types<
    313 // CHECK-NOELIDE-TREE:     int,
    314 // CHECK-NOELIDE-TREE:     int,
    315 // CHECK-NOELIDE-TREE:     [int != (no argument)]>
    316 
    317 template<int ...A> class class_ints {};
    318 void set11(class_ints<2, 3>) {}
    319 void test11() {
    320   set11(class_ints<1>());
    321   set11(class_ints<0, 3, 6>());
    322 }
    323 // CHECK-ELIDE-NOTREE: no matching function for call to 'set11'
    324 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class_ints<1, (no argument)>' to 'class_ints<2, 3>' for 1st argument
    325 // CHECK-ELIDE-NOTREE: no matching function for call to 'set11'
    326 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class_ints<0, [...], 6>' to 'class_ints<2, [...], (no argument)>' for 1st argument
    327 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set11'
    328 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class_ints<1, (no argument)>' to 'class_ints<2, 3>' for 1st argument
    329 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set11'
    330 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class_ints<0, 3, 6>' to 'class_ints<2, 3, (no argument)>' for 1st argument
    331 // CHECK-ELIDE-TREE: no matching function for call to 'set11'
    332 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    333 // CHECK-ELIDE-TREE:   class_ints<
    334 // CHECK-ELIDE-TREE:     [1 != 2],
    335 // CHECK-ELIDE-TREE:     [(no argument) != 3]>
    336 // CHECK-ELIDE-TREE: no matching function for call to 'set11'
    337 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    338 // CHECK-ELIDE-TREE:   class_ints<
    339 // CHECK-ELIDE-TREE:     [0 != 2],
    340 // CHECK-ELIDE-TREE:     [...],
    341 // CHECK-ELIDE-TREE:     [6 != (no argument)]>
    342 // CHECK-NOELIDE-TREE: no matching function for call to 'set11'
    343 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    344 // CHECK-NOELIDE-TREE:   class_ints<
    345 // CHECK-NOELIDE-TREE:     [1 != 2],
    346 // CHECK-NOELIDE-TREE:     [(no argument) != 3]>
    347 // CHECK-NOELIDE-TREE: no matching function for call to 'set11'
    348 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    349 // CHECK-NOELIDE-TREE:   class_ints<
    350 // CHECK-NOELIDE-TREE:     [0 != 2],
    351 // CHECK-NOELIDE-TREE:     3,
    352 // CHECK-NOELIDE-TREE:     [6 != (no argument)]>
    353 
    354 template<template<class> class ...A> class class_template_templates {};
    355 template<class> class tt1 {};
    356 template<class> class tt2 {};
    357 void set12(class_template_templates<tt1, tt1>) {}
    358 void test12() {
    359   set12(class_template_templates<tt2>());
    360   set12(class_template_templates<tt1, tt1, tt1>());
    361 }
    362 // CHECK-ELIDE-NOTREE: no matching function for call to 'set12'
    363 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class_template_templates<template tt2, template (no argument)>' to 'class_template_templates<template tt1, template tt1>' for 1st argument
    364 // CHECK-ELIDE-NOTREE: no matching function for call to 'set12'
    365 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class_template_templates<[2 * ...], template tt1>' to 'class_template_templates<[2 * ...], template (no argument)>' for 1st argument
    366 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set12'
    367 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class_template_templates<template tt2, template (no argument)>' to 'class_template_templates<template tt1, template tt1>' for 1st argument
    368 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set12'
    369 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class_template_templates<template tt1, template tt1, template tt1>' to 'class_template_templates<template tt1, template tt1, template (no argument)>' for 1st argument
    370 // CHECK-ELIDE-TREE: no matching function for call to 'set12'
    371 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    372 // CHECK-ELIDE-TREE:   class_template_templates<
    373 // CHECK-ELIDE-TREE:     [template tt2 != template tt1],
    374 // CHECK-ELIDE-TREE:     [template (no argument) != template tt1]>
    375 // CHECK-ELIDE-TREE: no matching function for call to 'set12'
    376 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    377 // CHECK-ELIDE-TREE:   class_template_templates<
    378 // CHECK-ELIDE-TREE:     [2 * ...],
    379 // CHECK-ELIDE-TREE:     [template tt1 != template (no argument)]>
    380 // CHECK-NOELIDE-TREE: no matching function for call to 'set12'
    381 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    382 // CHECK-NOELIDE-TREE:   class_template_templates<
    383 // CHECK-NOELIDE-TREE:     [template tt2 != template tt1],
    384 // CHECK-NOELIDE-TREE:     [template (no argument) != template tt1]>
    385 // CHECK-NOELIDE-TREE: no matching function for call to 'set12'
    386 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    387 // CHECK-NOELIDE-TREE:   class_template_templates<
    388 // CHECK-NOELIDE-TREE:     template tt1,
    389 // CHECK-NOELIDE-TREE:     template tt1,
    390 // CHECK-NOELIDE-TREE:     [template tt1 != template (no argument)]>
    391 
    392 double a13, b13, c13, d13;
    393 template<double* ...A> class class_ptrs {};
    394 void set13(class_ptrs<&a13, &b13>) {}
    395 void test13() {
    396   set13(class_ptrs<&c13>());
    397   set13(class_ptrss<&a13, &b13, &d13>());
    398 }
    399 // CHECK-ELIDE-NOTREE: no matching function for call to 'set13'
    400 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class_ptrs<&c13, (no argument)>' to 'class_ptrs<&a13, &b13>' for 1st argument
    401 // CHECK-ELIDE-NOTREE: no matching function for call to 'set13'
    402 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'class_ptrs<[2 * ...], &d13>' to 'class_ptrs<[2 * ...], (no argument)>' for 1st argument
    403 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set13'
    404 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class_ptrs<&c13, (no argument)>' to 'class_ptrs<&a13, &b13>' for 1st argument
    405 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set13'
    406 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'class_ptrs<&a13, &b13, &d13>' to 'class_ptrs<&a13, &b13, (no argument)>' for 1st argument
    407 // CHECK-ELIDE-TREE: no matching function for call to 'set13'
    408 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    409 // CHECK-ELIDE-TREE:   class_ptrs<
    410 // CHECK-ELIDE-TREE:     [&c13 != &a13],
    411 // CHECK-ELIDE-TREE:     [(no argument) != &b13]>
    412 // CHECK-ELIDE-TREE: no matching function for call to 'set13'
    413 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    414 // CHECK-ELIDE-TREE:   class_ptrs<
    415 // CHECK-ELIDE-TREE:     [2 * ...],
    416 // CHECK-ELIDE-TREE:     [&d13 != (no argument)]>
    417 // CHECK-NOELIDE-TREE: no matching function for call to 'set13'
    418 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    419 // CHECK-NOELIDE-TREE:   class_ptrs<
    420 // CHECK-NOELIDE-TREE:     [&c13 != &a13],
    421 // CHECK-NOELIDE-TREE:     [(no argument) != &b13]>
    422 // CHECK-NOELIDE-TREE: no matching function for call to 'set13'
    423 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    424 // CHECK-NOELIDE-TREE:   class_ptrs<
    425 // CHECK-NOELIDE-TREE:     &a13,
    426 // CHECK-NOELIDE-TREE:     &b13,
    427 // CHECK-NOELIDE-TREE:     [&d13 != (no argument)]>
    428 
    429 template<typename T> struct s14 {};
    430 template<typename T> using a14 = s14<T>;
    431 typedef a14<int> b14;
    432 template<typename T> using c14 = b14;
    433 int f14(c14<int>);
    434 int k14 = f14(a14<char>());
    435 // CHECK-ELIDE-NOTREE: no matching function for call to 'f14'
    436 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'a14<char>' to 'a14<int>' for 1st argument
    437 // CHECK-NOELIDE-NOTREE: no matching function for call to 'f14'
    438 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'a14<char>' to 'a14<int>' for 1st argument
    439 // CHECK-ELIDE-TREE: no matching function for call to 'f14'
    440 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    441 // CHECK-ELIDE-TREE:   a14<
    442 // CHECK-ELIDE-TREE:     [char != int]>
    443 // CHECK-NOELIDE-TREE: no matching function for call to 'f14'
    444 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    445 // CHECK-NOELIDE-TREE:   a14<
    446 // CHECK-NOELIDE-TREE:     [char != int]>
    447 
    448 void set15(vector<vector<int>>) {}
    449 void test15() {
    450   set15(vector<vector<int>>());
    451 }
    452 // CHECK-ELIDE-NOTREE-NOT: set15
    453 // CHECK-NOELIDE-NOTREE-NOT: set15
    454 // CHECK-ELIDE-TREE-NOT: set15
    455 // CHECK-NOELIDE-TREE-NOT: set15
    456 // no error here
    457 
    458 void set16(vector<const vector<int>>) {}
    459 void test16() {
    460   set16(vector<const vector<const int>>());
    461 }
    462 // CHECK-ELIDE-NOTREE: no matching function for call to 'set16'
    463 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<const vector<const int>>' to 'vector<const vector<int>>' for 1st argument
    464 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set16'
    465 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<const vector<const int>>' to 'vector<const vector<int>>' for 1st argument
    466 // CHECK-ELIDE-TREE: no matching function for call to 'set16'
    467 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    468 // CHECK-ELIDE-TREE:   vector<
    469 // CHECK-ELIDE-TREE:     const vector<
    470 // CHECK-ELIDE-TREE:       [const != (no qualifiers)] int>>
    471 // CHECK-NOELIDE-TREE: no matching function for call to 'set16'
    472 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    473 // CHECK-NOELIDE-TREE:   vector<
    474 // CHECK-NOELIDE-TREE:     const vector<
    475 // CHECK-NOELIDE-TREE:       [const != (no qualifiers)] int>>
    476 
    477 void set17(vector<vector<int>>) {}
    478 void test17() {
    479   set17(vector<const vector<int>>());
    480 }
    481 // CHECK-ELIDE-NOTREE: no matching function for call to 'set17'
    482 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<const vector<...>>' to 'vector<vector<...>>' for 1st argument
    483 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set17'
    484 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<const vector<int>>' to 'vector<vector<int>>' for 1st argument
    485 // CHECK-ELIDE-TREE: no matching function for call to 'set17'
    486 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    487 // CHECK-ELIDE-TREE:   vector<
    488 // CHECK-ELIDE-TREE:     [const != (no qualifiers)] vector<...>>
    489 // CHECK-NOELIDE-TREE: no matching function for call to 'set17'
    490 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    491 // CHECK-NOELIDE-TREE:   vector<
    492 // CHECK-NOELIDE-TREE:     [const != (no qualifiers)] vector<
    493 // CHECK-NOELIDE-TREE:       int>>
    494 
    495 void set18(vector<const vector<int>>) {}
    496 void test18() {
    497   set18(vector<vector<int>>());
    498 }
    499 // CHECK-ELIDE-NOTREE: no matching function for call to 'set18'
    500 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<vector<...>>' to 'vector<const vector<...>>' for 1st argument
    501 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set18'
    502 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<vector<int>>' to 'vector<const vector<int>>' for 1st argument
    503 // CHECK-ELIDE-TREE: no matching function for call to 'set18'
    504 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    505 // CHECK-ELIDE-TREE:   vector<
    506 // CHECK-ELIDE-TREE:     [(no qualifiers) != const] vector<...>>
    507 // CHECK-NOELIDE-TREE: no matching function for call to 'set18'
    508 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    509 // CHECK-NOELIDE-TREE:   vector<
    510 // CHECK-NOELIDE-TREE:     [(no qualifiers) != const] vector<
    511 // CHECK-NOELIDE-TREE:       int>>
    512 
    513 void set19(vector<volatile vector<int>>) {}
    514 void test19() {
    515   set19(vector<const vector<int>>());
    516 }
    517 // CHECK-ELIDE-NOTREE: no matching function for call to 'set19'
    518 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<const vector<...>>' to 'vector<volatile vector<...>>' for 1st argument
    519 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set19'
    520 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<const vector<int>>' to 'vector<volatile vector<int>>' for 1st argument
    521 // CHECK-ELIDE-TREE: no matching function for call to 'set19'
    522 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    523 // CHECK-ELIDE-TREE:   vector<
    524 // CHECK-ELIDE-TREE:     [const != volatile] vector<...>>
    525 // CHECK-NOELIDE-TREE: no matching function for call to 'set19'
    526 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    527 // CHECK-NOELIDE-TREE:   vector<
    528 // CHECK-NOELIDE-TREE:     [const != volatile] vector<
    529 // CHECK-NOELIDE-TREE:       int>>
    530 
    531 void set20(vector<const volatile vector<int>>) {}
    532 void test20() {
    533   set20(vector<const vector<int>>());
    534 }
    535 // CHECK-ELIDE-NOTREE: no matching function for call to 'set20'
    536 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<const vector<...>>' to 'vector<const volatile vector<...>>' for 1st argument
    537 // CHECK-NOELIDE-NOTREE: no matching function for call to 'set20'
    538 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<const vector<int>>' to 'vector<const volatile vector<int>>' for 1st argument
    539 // CHECK-ELIDE-TREE: no matching function for call to 'set20'
    540 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    541 // CHECK-ELIDE-TREE:   vector<
    542 // CHECK-ELIDE-TREE:     [const != const volatile] vector<...>>
    543 // CHECK-NOELIDE-TREE: no matching function for call to 'set20'
    544 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    545 // CHECK-NOELIDE-TREE:   vector<
    546 // CHECK-NOELIDE-TREE:     [const != const volatile] vector<
    547 // CHECK-NOELIDE-TREE:       int>>
    548 
    549 
    550 // Checks that volatile does not show up in diagnostics.
    551 template<typename T> struct S21 {};
    552 template<typename T> using U21 = volatile S21<T>;
    553 int f21(vector<const U21<int>>);
    554 int k21 = f21(vector<U21<int>>());
    555 // CHECK-ELIDE-NOTREE: no matching function for call to 'f21'
    556 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<U21<...>>' to 'vector<const U21<...>>' for 1st argument
    557 // CHECK-NOELIDE-NOTREE: no matching function for call to 'f21'
    558 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<U21<int>>' to 'vector<const U21<int>>' for 1st argument
    559 // CHECK-ELIDE-TREE: no matching function for call to 'f21'
    560 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    561 // CHECK-ELIDE-TREE:    vector<
    562 // CHECK-ELIDE-TREE:      [(no qualifiers) != const] U21<...>>
    563 // CHECK-NOELIDE-TREE: no matching function for call to 'f21'
    564 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    565 // CHECK-NOELIDE-TREE:    vector<
    566 // CHECK-NOELIDE-TREE:      [(no qualifiers) != const] U21<
    567 // CHECK-NOELIDE-TREE:        int>>
    568 
    569 // Checks that volatile does not show up in diagnostics.
    570 template<typename T> struct S22 {};
    571 template<typename T> using U22 = volatile S22<T>;
    572 int f22(vector<volatile const U22<int>>);
    573 int k22 = f22(vector<volatile U22<int>>());
    574 // CHECK-ELIDE-NOTREE: no matching function for call to 'f22'
    575 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<U22<...>>' to 'vector<const U22<...>>' for 1st argument
    576 // CHECK-NOELIDE-NOTREE: no matching function for call to 'f22'
    577 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'vector<U22<int>>' to 'vector<const U22<int>>' for 1st argument
    578 // CHECK-ELIDE-TREE: no matching function for call to 'f22'
    579 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    580 // CHECK-ELIDE-TREE:    vector<
    581 // CHECK-ELIDE-TREE:      [(no qualifiers) != const] U22<...>>
    582 // CHECK-NOELIDE-TREE: no matching function for call to 'f22'
    583 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    584 // CHECK-NOELIDE-TREE:    vector<
    585 // CHECK-NOELIDE-TREE:      [(no qualifiers) != const] U22<
    586 // CHECK-NOELIDE-TREE:        int>>
    587 
    588 // Testing qualifiers and typedefs.
    589 template <class T> struct D23{};
    590 template <class T> using C23 = D23<T>;
    591 typedef const C23<int> B23;
    592 template<class ...T> using A23 = B23;
    593 
    594 void foo23(D23<A23<>> b) {}
    595 void test23() {
    596   foo23(D23<D23<char>>());
    597   foo23(C23<char>());
    598 }
    599 
    600 // CHECK-ELIDE-NOTREE: no matching function for call to 'foo23'
    601 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'D23<D23<char>>' to 'D23<const D23<int>>' for 1st argument
    602 // CHECK-ELIDE-NOTREE: no matching function for call to 'foo23'
    603 // CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'D23<char>' to 'D23<A23<>>' for 1st argument
    604 // CHECK-NOELIDE-NOTREE: no matching function for call to 'foo23'
    605 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'D23<D23<char>>' to 'D23<const D23<int>>' for 1st argument
    606 // CHECK-NOELIDE-NOTREE: no matching function for call to 'foo23'
    607 // CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'D23<char>' to 'D23<A23<>>' for 1st argument
    608 // CHECK-ELIDE-TREE: no matching function for call to 'foo23'
    609 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    610 // CHECK-ELIDE-TREE:   D23<
    611 // CHECK-ELIDE-TREE:     [(no qualifiers) != const] D23<
    612 // CHECK-ELIDE-TREE:       [char != int]>>
    613 // CHECK-ELIDE-TREE: no matching function for call to 'foo23'
    614 // CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    615 // CHECK-ELIDE-TREE:   D23<
    616 // CHECK-ELIDE-TREE:     [char != A23<>]>
    617 // CHECK-NOELIDE-TREE: no matching function for call to 'foo23'
    618 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    619 // CHECK-NOELIDE-TREE:   D23<
    620 // CHECK-NOELIDE-TREE:     [(no qualifiers) != const] D23<
    621 // CHECK-NOELIDE-TREE:       [char != int]>>
    622 // CHECK-NOELIDE-TREE: no matching function for call to 'foo23'
    623 // CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
    624 // CHECK-NOELIDE-TREE:   D23<
    625 // CHECK-NOELIDE-TREE:     [char != A23<>]>
    626 
    627 namespace PR14015 {
    628 template <unsigned N> class Foo1 {};
    629 template <unsigned N = 2> class Foo2 {};
    630 template <unsigned ...N> class Foo3 {};
    631 
    632 void Play1() {
    633   Foo1<1> F1;
    634   Foo1<2> F2, F3;
    635   F2 = F1;
    636   F1 = F2;
    637   F2 = F3;
    638   F3 = F2;
    639 }
    640 
    641 // CHECK-ELIDE-NOTREE: no viable overloaded '='
    642 // 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
    643 // CHECK-ELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo1<1>' to 'Foo1<2>' for 1st argument
    644 // CHECK-ELIDE-NOTREE: no viable overloaded '='
    645 // 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
    646 // CHECK-ELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo1<2>' to 'Foo1<1>' for 1st argument
    647 // CHECK-NOELIDE-NOTREE: no viable overloaded '='
    648 // 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
    649 // CHECK-NOELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo1<1>' to 'Foo1<2>' for 1st argument
    650 // CHECK-NOELIDE-NOTREE: no viable overloaded '='
    651 // 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
    652 // CHECK-NOELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo1<2>' to 'Foo1<1>' for 1st argument
    653 // CHECK-ELIDE-TREE: no viable overloaded '='
    654 // CHECK-ELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
    655 // CHECK-ELIDE-TREE:   [(no qualifiers) != const] Foo1<
    656 // CHECK-ELIDE-TREE:     [1 != 2]>
    657 // CHECK-ELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
    658 // CHECK-ELIDE-TREE:   Foo1<
    659 // CHECK-ELIDE-TREE:     [1 != 2]>
    660 // CHECK-ELIDE-TREE: no viable overloaded '='
    661 // CHECK-ELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
    662 // CHECK-ELIDE-TREE:   [(no qualifiers) != const] Foo1<
    663 // CHECK-ELIDE-TREE:     [2 != 1]>
    664 // CHECK-ELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
    665 // CHECK-ELIDE-TREE:   Foo1<
    666 // CHECK-ELIDE-TREE:     [2 != 1]>
    667 // CHECK-NOELIDE-TREE: no viable overloaded '='
    668 // CHECK-NOELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
    669 // CHECK-NOELIDE-TREE:   [(no qualifiers) != const] Foo1<
    670 // CHECK-NOELIDE-TREE:     [1 != 2]>
    671 // CHECK-NOELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
    672 // CHECK-NOELIDE-TREE:   Foo1<
    673 // CHECK-NOELIDE-TREE:     [1 != 2]>
    674 // CHECK-NOELIDE-TREE: no viable overloaded '='
    675 // CHECK-NOELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
    676 // CHECK-NOELIDE-TREE:   [(no qualifiers) != const] Foo1<
    677 // CHECK-NOELIDE-TREE:     [2 != 1]>
    678 // CHECK-NOELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
    679 // CHECK-NOELIDE-TREE:   Foo1<
    680 // CHECK-NOELIDE-TREE:     [2 != 1]>
    681 
    682 void Play2() {
    683   Foo2<1> F1;
    684   Foo2<> F2, F3;
    685   F2 = F1;
    686   F1 = F2;
    687   F2 = F3;
    688   F3 = F2;
    689 }
    690 // CHECK-ELIDE-NOTREE: no viable overloaded '='
    691 // 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
    692 // CHECK-ELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo2<1>' to 'Foo2<2>' for 1st argument
    693 // CHECK-ELIDE-NOTREE: no viable overloaded '='
    694 // 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
    695 // 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
    696 // CHECK-NOELIDE-NOTREE: no viable overloaded '='
    697 // 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
    698 // CHECK-NOELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo2<1>' to 'Foo2<2>' for 1st argument
    699 // CHECK-NOELIDE-NOTREE: no viable overloaded '='
    700 // 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
    701 // 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
    702 // CHECK-ELIDE-TREE: no viable overloaded '='
    703 // CHECK-ELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
    704 // CHECK-ELIDE-TREE:   [(no qualifiers) != const] Foo2<
    705 // CHECK-ELIDE-TREE:     [1 != 2]>
    706 // CHECK-ELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
    707 // CHECK-ELIDE-TREE:   Foo2<
    708 // CHECK-ELIDE-TREE:     [1 != 2]>
    709 // CHECK-ELIDE-TREE: no viable overloaded '='
    710 // CHECK-ELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
    711 // CHECK-ELIDE-TREE:   [(no qualifiers) != const] Foo2<
    712 // CHECK-ELIDE-TREE:     [(default) 2 != 1]>
    713 // CHECK-ELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
    714 // CHECK-ELIDE-TREE:   Foo2<
    715 // CHECK-ELIDE-TREE:     [(default) 2 != 1]>
    716 // CHECK-NOELIDE-TREE: no viable overloaded '='
    717 // CHECK-NOELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
    718 // CHECK-NOELIDE-TREE:   [(no qualifiers) != const] Foo2<
    719 // CHECK-NOELIDE-TREE:     [1 != 2]>
    720 // CHECK-NOELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
    721 // CHECK-NOELIDE-TREE:   Foo2<
    722 // CHECK-NOELIDE-TREE:     [1 != 2]>
    723 // CHECK-NOELIDE-TREE: no viable overloaded '='
    724 // CHECK-NOELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
    725 // CHECK-NOELIDE-TREE:   [(no qualifiers) != const] Foo2<
    726 // CHECK-NOELIDE-TREE:     [(default) 2 != 1]>
    727 // CHECK-NOELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
    728 // CHECK-NOELIDE-TREE:   Foo2<
    729 // CHECK-NOELIDE-TREE:     [(default) 2 != 1]>
    730 
    731 void Play3() {
    732   Foo3<1> F1;
    733   Foo3<2, 1> F2, F3;
    734   F2 = F1;
    735   F1 = F2;
    736   F2 = F3;
    737   F3 = F2;
    738 }
    739 // CHECK-ELIDE-NOTREE: no viable overloaded '='
    740 // 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
    741 // 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
    742 // CHECK-ELIDE-NOTREE: no viable overloaded '='
    743 // 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
    744 // 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
    745 // CHECK-NOELIDE-NOTREE: no viable overloaded '='
    746 // 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
    747 // 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
    748 // CHECK-NOELIDE-NOTREE: no viable overloaded '='
    749 // 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
    750 // 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
    751 // CHECK-ELIDE-TREE: no viable overloaded '='
    752 // CHECK-ELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
    753 // CHECK-ELIDE-TREE:   [(no qualifiers) != const] Foo3<
    754 // CHECK-ELIDE-TREE:     [1 != 2],
    755 // CHECK-ELIDE-TREE:     [(no argument) != 1]>
    756 // CHECK-ELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
    757 // CHECK-ELIDE-TREE:   Foo3<
    758 // CHECK-ELIDE-TREE:     [1 != 2],
    759 // CHECK-ELIDE-TREE:     [(no argument) != 1]>
    760 // CHECK-ELIDE-TREE: no viable overloaded '='
    761 // CHECK-ELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
    762 // CHECK-ELIDE-TREE:   [(no qualifiers) != const] Foo3<
    763 // CHECK-ELIDE-TREE:     [2 != 1],
    764 // CHECK-ELIDE-TREE:     [1 != (no argument)]>
    765 // CHECK-ELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
    766 // CHECK-ELIDE-TREE:   Foo3<
    767 // CHECK-ELIDE-TREE:     [2 != 1],
    768 // CHECK-ELIDE-TREE:     [1 != (no argument)]>
    769 // CHECK-NOELIDE-TREE: no viable overloaded '='
    770 // CHECK-NOELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
    771 // CHECK-NOELIDE-TREE:   [(no qualifiers) != const] Foo3<
    772 // CHECK-NOELIDE-TREE:     [1 != 2],
    773 // CHECK-NOELIDE-TREE:     [(no argument) != 1]>
    774 // CHECK-NOELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
    775 // CHECK-NOELIDE-TREE:   Foo3<
    776 // CHECK-NOELIDE-TREE:     [1 != 2],
    777 // CHECK-NOELIDE-TREE:     [(no argument) != 1]>
    778 // CHECK-NOELIDE-TREE: no viable overloaded '='
    779 // CHECK-NOELIDE-TREE: candidate function (the implicit copy assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
    780 // CHECK-NOELIDE-TREE:   [(no qualifiers) != const] Foo3<
    781 // CHECK-NOELIDE-TREE:     [2 != 1],
    782 // CHECK-NOELIDE-TREE:     [1 != (no argument)]>
    783 // CHECK-NOELIDE-TREE: candidate function (the implicit move assignment operator) not viable: no known conversion from argument type to parameter type for 1st argument
    784 // CHECK-NOELIDE-TREE:   Foo3<
    785 // CHECK-NOELIDE-TREE:     [2 != 1],
    786 // CHECK-NOELIDE-TREE:     [1 != (no argument)]>
    787 }
    788 
    789 namespace PR14342 {
    790   template<typename T, short a> struct X {};
    791   X<int, (signed char)-1> x = X<long, -1>();
    792   X<int, 3UL> y = X<int, 2>();
    793   // CHECK-ELIDE-NOTREE: error: no viable conversion from 'X<long, [...]>' to 'X<int, [...]>'
    794   // CHECK-ELIDE-NOTREE: error: no viable conversion from 'X<[...], 2>' to 'X<[...], 3>'
    795 }
    796 
    797 namespace PR14489 {
    798   // The important thing here is that the diagnostic diffs a template specialization
    799   // with no arguments against itself.  (We might need a different test if this
    800   // diagnostic changes).
    801   template<class ...V>
    802   struct VariableList   {
    803     void ConnectAllToAll(VariableList<>& params = VariableList<>())    {
    804     }
    805   };
    806   // CHECK-ELIDE-NOTREE: non-const lvalue reference to type 'VariableList<>' cannot bind to a temporary of type 'VariableList<>'
    807 }
    808 
    809 namespace rdar12456626 {
    810   struct IntWrapper {
    811     typedef int type;
    812   };
    813 
    814   template<typename T, typename T::type V>
    815   struct X { };
    816 
    817   struct A {
    818     virtual X<IntWrapper, 1> foo();
    819   };
    820 
    821   struct B : A {
    822     // CHECK-ELIDE-NOTREE: virtual function 'foo' has a different return type
    823     virtual X<IntWrapper, 2> foo();
    824   };
    825 }
    826 
    827 namespace PR15023 {
    828   // Don't crash when non-QualTypes are passed to a diff modifier.
    829   template <typename... Args>
    830   void func(void (*func)(Args...), Args...) { }
    831 
    832   void bar(int, int &) {
    833   }
    834 
    835   void foo(int x) {
    836     func(bar, 1, x)
    837   }
    838   // CHECK-ELIDE-NOTREE: no matching function for call to 'func'
    839   // CHECK-ELIDE-NOTREE: candidate template ignored: deduced conflicting types for parameter 'Args' (<int, int &> vs. <int, int>)
    840 }
    841 
    842 namespace rdar12931988 {
    843   namespace A {
    844     template<typename T> struct X { };
    845   }
    846 
    847   namespace B {
    848     template<typename T> struct X { };
    849   }
    850 
    851   void foo(A::X<int> &ax, B::X<int> bx) {
    852     // CHECK-ELIDE-NOTREE: no viable overloaded '='
    853     // CHECK-ELIDE-NOTREE: no known conversion from 'B::X<int>' to 'const rdar12931988::A::X<int>'
    854     ax = bx;
    855   }
    856 
    857   template<template<typename> class> class Y {};
    858 
    859   void bar(Y<A::X> ya, Y<B::X> yb) {
    860     // CHECK-ELIDE-NOTREE: no viable overloaded '='
    861     // CHECK-ELIDE-NOTREE: no known conversion from 'Y<template rdar12931988::B::X>' to 'Y<template rdar12931988::A::X>'
    862     ya = yb;
    863   }
    864 }
    865 
    866 namespace ValueDecl {
    867   int int1, int2, default_int;
    868   template <const int& T = default_int>
    869   struct S {};
    870 
    871   typedef S<int1> T1;
    872   typedef S<int2> T2;
    873   typedef S<> TD;
    874 
    875   void test() {
    876     T1 t1;
    877     T2 t2;
    878     TD td;
    879 
    880     t1 = t2;
    881     // CHECK-ELIDE-NOTREE: no viable overloaded '='
    882     // CHECK-ELIDE-NOTREE: no known conversion from 'S<int2>' to 'S<int1>'
    883 
    884     t2 = t1;
    885     // CHECK-ELIDE-NOTREE: no viable overloaded '='
    886     // CHECK-ELIDE-NOTREE: no known conversion from 'S<int1>' to 'S<int2>'
    887 
    888     td = t1;
    889     // TODO: Find out why (default) isn't printed on second template.
    890     // CHECK-ELIDE-NOTREE: no viable overloaded '='
    891     // CHECK-ELIDE-NOTREE: no known conversion from 'S<int1>' to 'S<default_int>'
    892 
    893     t2 = td;
    894     // CHECK-ELIDE-NOTREE: no viable overloaded '='
    895     // CHECK-ELIDE-NOTREE: no known conversion from 'S<(default) default_int>' to 'S<int2>'
    896 
    897   }
    898 }
    899 
    900 namespace DependentDefault {
    901   template <typename> struct Trait {
    902     enum { V = 40 };
    903     typedef int Ty;
    904     static int I;
    905   };
    906   int other;
    907 
    908   template <typename T, int = Trait<T>::V > struct A {};
    909   template <typename T, typename = Trait<T>::Ty > struct B {};
    910   template <typename T, int& = Trait<T>::I > struct C {};
    911 
    912   void test() {
    913 
    914     A<int> a1;
    915     A<char> a2;
    916     A<int, 10> a3;
    917     a1 = a2;
    918     // CHECK-ELIDE-NOTREE: no viable overloaded '='
    919     // CHECK-ELIDE-NOTREE: no known conversion from 'A<char, [...]>' to 'A<int, [...]>'
    920     a3 = a1;
    921     // CHECK-ELIDE-NOTREE: no viable overloaded '='
    922     // CHECK-ELIDE-NOTREE: no known conversion from 'A<[...], (default) Trait<T>::V aka 40>' to 'A<[...], 10>'
    923     a2 = a3;
    924     // CHECK-ELIDE-NOTREE: no viable overloaded '='
    925     // CHECK-ELIDE-NOTREE: no known conversion from 'A<int, 10>' to 'A<char, 40>'
    926 
    927     B<int> b1;
    928     B<char> b2;
    929     B<int, char> b3;
    930     b1 = b2;
    931     // CHECK-ELIDE-NOTREE: no viable overloaded '='
    932     // CHECK-ELIDE-NOTREE: no known conversion from 'B<char, [...]>' to 'B<int, [...]>'
    933     b3 = b1;
    934     // CHECK-ELIDE-NOTREE: no viable overloaded '='
    935     // CHECK-ELIDE-NOTREE: no known conversion from 'B<[...], (default) int>' to 'B<[...], char>'
    936     b2 = b3;
    937     // CHECK-ELIDE-NOTREE: no viable overloaded '='
    938     // CHECK-ELIDE-NOTREE: no known conversion from 'B<int, char>' to 'B<char, int>'
    939 
    940     C<int> c1;
    941     C<char> c2;
    942     C<int, other> c3;
    943     c1 = c2;
    944     // CHECK-ELIDE-NOTREE: no viable overloaded '='
    945     // CHECK-ELIDE-NOTREE: no known conversion from 'C<char, (default) I>' to 'C<int, I>'
    946     c3 = c1;
    947     // CHECK-ELIDE-NOTREE: no viable overloaded '='
    948     // CHECK-ELIDE-NOTREE: no known conversion from 'C<[...], (default) I>' to 'C<[...], other>'
    949     c2 = c3;
    950     // CHECK-ELIDE-NOTREE: no viable overloaded '='
    951     // CHECK-ELIDE-NOTREE: no known conversion from 'C<int, other>' to 'C<char, I>'
    952   }
    953 }
    954 
    955 namespace VariadicDefault {
    956   int i1, i2, i3;
    957   template <int = 5, int...> struct A {};
    958   template <int& = i1, int& ...> struct B {};
    959   template <typename = void, typename...> struct C {};
    960 
    961   void test() {
    962     A<> a1;
    963     A<5, 6, 7> a2;
    964     A<1, 2> a3;
    965     a2 = a1;
    966     // CHECK-ELIDE-NOTREE: no viable overloaded '='
    967     // CHECK-ELIDE-NOTREE: no known conversion from 'A<[...], (no argument), (no argument)>' to 'A<[...], 6, 7>'
    968     a3 = a1;
    969     // CHECK-ELIDE-NOTREE: no viable overloaded '='
    970     // CHECK-ELIDE-NOTREE: no known conversion from 'A<(default) 5, (no argument)>' to 'A<1, 2>'
    971 
    972     B<> b1;
    973     B<i1, i2, i3> b2;
    974     B<i2, i3> b3;
    975     b2 = b1;
    976     // CHECK-ELIDE-NOTREE: no viable overloaded '='
    977     // CHECK-ELIDE-NOTREE: no known conversion from 'B<[...], (no argument), (no argument)>' to 'B<[...], i2, i3>'
    978     b3 = b1;
    979     // CHECK-ELIDE-NOTREE: no viable overloaded '='
    980     // CHECK-ELIDE-NOTREE: no known conversion from 'B<(default) i1, (no argument)>' to 'B<i2, i3>'
    981 
    982     B<i1, i2, i3> b4 = b1;
    983     // CHECK-ELIDE-NOTREE: no viable conversion from 'B<[...], (no argument), (no argument)>' to 'B<[...], i2, i3>'
    984     B<i2, i3> b5 = b1;
    985     // CHECK-ELIDE-NOTREE: no viable conversion from 'B<(default) i1, (no argument)>' to 'B<i2, i3>'
    986 
    987     C<> c1;
    988     C<void, void> c2;
    989     C<char, char> c3;
    990     c2 = c1;
    991     // CHECK-ELIDE-NOTREE: no viable overloaded '='
    992     // CHECK-ELIDE-NOTREE: no known conversion from 'C<[...], (no argument)>' to 'C<[...], void>'
    993     c3 = c1;
    994     // CHECK-ELIDE-NOTREE: no viable overloaded '='
    995     // CHECK-ELIDE-NOTREE: no known conversion from 'C<(default) void, (no argument)>' to 'C<char, char>'
    996   }
    997 }
    998 
    999 namespace PointerArguments {
   1000   template <int *p> class T {};
   1001   template <int* ...> class U {};
   1002   int a, b, c;
   1003   int z[5];
   1004   void test() {
   1005     T<&a> ta;
   1006     T<z> tz;
   1007     T<&b> tb(ta);
   1008     // CHECK-ELIDE-NOTREE: no matching constructor for initialization of 'T<&b>'
   1009     // CHECK-ELIDE-NOTREE: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'T<&a>' to 'const T<&b>' for 1st argument
   1010     T<&c> tc(tz);
   1011     // CHECK-ELIDE-NOTREE: no matching constructor for initialization of 'T<&c>'
   1012     // CHECK-ELIDE-NOTREE: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'T<z>' to 'const T<&c>' for 1st argument
   1013 
   1014     U<&a, &a> uaa;
   1015     U<&b> ub(uaa);
   1016     // CHECK-ELIDE-NOTREE: no matching constructor for initialization of 'U<&b>'
   1017     // 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
   1018 
   1019     U<&b, &b, &b> ubbb(uaa);
   1020     // CHECK-ELIDE-NOTREE: no matching constructor for initialization of 'U<&b, &b, &b>'
   1021     // 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
   1022 
   1023   }
   1024 }
   1025 
   1026 namespace DependentInt {
   1027   template<int Num> struct INT;
   1028 
   1029   template <class CLASS, class Int_wrapper = INT<CLASS::val> >
   1030   struct C;
   1031 
   1032   struct N {
   1033     static const int val = 1;
   1034   };
   1035 
   1036   template <class M_T>
   1037   struct M {};
   1038 
   1039   void test() {
   1040     using T1 = M<C<int, INT<0>>>;
   1041     using T2 = M<C<N>>;
   1042     T2 p;
   1043     T1 x = p;
   1044     // CHECK-ELIDE-NOTREE: no viable conversion from 'M<C<DependentInt::N, INT<1>>>' to 'M<C<int, INT<0>>>'
   1045   }
   1046 }
   1047 
   1048 namespace PR17510 {
   1049 class Atom;
   1050 
   1051 template <typename T> class allocator;
   1052 template <typename T, typename A> class vector;
   1053 
   1054 typedef vector<const Atom *, allocator<const Atom *> > AtomVector;
   1055 
   1056 template <typename T, typename A = allocator<const Atom *> > class vector {};
   1057 
   1058 void foo() {
   1059   vector<Atom *> v;
   1060   AtomVector v2(v);
   1061   // CHECK-ELIDE-NOTREE: no known conversion from 'vector<PR17510::Atom *, [...]>' to 'const vector<const PR17510::Atom *, [...]>'
   1062 }
   1063 }
   1064 
   1065 namespace PR15677 {
   1066 template <bool>
   1067 struct A{};
   1068 
   1069 template <typename T>
   1070 using B = A<T::value>;
   1071 
   1072 template <typename T>
   1073 using B = A<!T::value>;
   1074 // CHECK-ELIDE-NOTREE: type alias template redefinition with different types ('A<!T::value>' vs 'A<T::value>')
   1075 
   1076 template <int>
   1077 struct C{};
   1078 
   1079 template <typename T>
   1080 using D = C<T::value>;
   1081 
   1082 template <typename T>
   1083 using D = C<T::value + 1>;
   1084 // CHECK-ELIDE-NOTREE: type alias template redefinition with different types ('C<T::value + 1>' vs 'C<T::value>')
   1085 
   1086 template <typename T>
   1087 using E = C<T::value>;
   1088 
   1089 template <typename T>
   1090 using E = C<42>;
   1091 // CHECK-ELIDE-NOTREE: type alias template redefinition with different types ('C<42>' vs 'C<T::value>')
   1092 
   1093 template <typename T>
   1094 using F = C<T::value>;
   1095 
   1096 template <typename T>
   1097 using F = C<21 + 21>;
   1098 // CHECK-ELIDE-NOTREE: type alias template redefinition with different types ('C<21 + 21 aka 42>' vs 'C<T::value>')
   1099 }
   1100 }
   1101 
   1102 namespace AddressOf {
   1103 template <int*>
   1104 struct S {};
   1105 
   1106 template <class T>
   1107 struct Wrapper {};
   1108 
   1109 template <class T>
   1110 Wrapper<T> MakeWrapper();
   1111 int global, global2;
   1112 constexpr int * ptr = nullptr;
   1113 Wrapper<S<ptr>> W = MakeWrapper<S<&global>>();
   1114 // Don't print an extra '&' for 'ptr'
   1115 // CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global>>' to 'Wrapper<S<ptr aka nullptr>>'
   1116 
   1117 // Handle parens correctly
   1118 Wrapper<S<(&global2)>> W2 = MakeWrapper<S<&global>>();
   1119 // CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global>>' to 'Wrapper<S<&global2>>'
   1120 Wrapper<S<&global2>> W3 = MakeWrapper<S<(&global)>>();
   1121 // CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global>>' to 'Wrapper<S<&global2>>'
   1122 Wrapper<S<(&global2)>> W4 = MakeWrapper<S<(&global)>>();
   1123 // CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global>>' to 'Wrapper<S<&global2>>'
   1124 }
   1125 
   1126 namespace NullPtr {
   1127 template <int*, int*>
   1128 struct S {};
   1129 
   1130 template <class T>
   1131 struct Wrapper {};
   1132 
   1133 template <class T>
   1134 Wrapper<T> MakeWrapper();
   1135 int global, global2;
   1136 constexpr int * ptr = nullptr;
   1137 constexpr int * ptr2 = static_cast<int*>(0);
   1138 
   1139 S<&global> s1 = S<&global, ptr>();
   1140 S<&global, nullptr> s2 = S<&global, ptr>();
   1141 
   1142 S<&global, nullptr> s3 = S<&global, &global>();
   1143 // CHECK-ELIDE-NOTREE: no viable conversion from 'S<[...], &global>' to 'S<[...], nullptr>'
   1144 S<&global, ptr> s4 = S<&global, &global>();
   1145 // CHECK-ELIDE-NOTREE: no viable conversion from 'S<[...], &global>' to 'S<[...], ptr aka nullptr>
   1146 
   1147 Wrapper<S<&global, nullptr>> W1 = MakeWrapper<S<&global, ptr>>();
   1148 Wrapper<S<&global, static_cast<int*>(0)>> W2 = MakeWrapper<S<&global, ptr>>();
   1149 
   1150 Wrapper<S<&global, nullptr>> W3 = MakeWrapper<S<&global, &global>>();
   1151 // CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<[...], &global>>' to 'Wrapper<S<[...], nullptr>>'
   1152 Wrapper<S<&global, ptr>> W4 = MakeWrapper<S<&global, &global>>();
   1153 // CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<[...], &global>>' to 'Wrapper<S<[...], ptr aka nullptr>>'
   1154 
   1155 Wrapper<S<&global2, ptr>> W5 = MakeWrapper<S<&global, nullptr>>();
   1156 // CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global, [...]>>' to 'Wrapper<S<&global2, [...]>>'
   1157 Wrapper<S<&global2, nullptr>> W6 = MakeWrapper<S<&global, nullptr>>();
   1158 // CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global, [...]>>' to 'Wrapper<S<&global2, [...]>>'
   1159 Wrapper<S<&global2, ptr2>> W7 = MakeWrapper<S<&global, nullptr>>();
   1160 // CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global, [...]>>' to 'Wrapper<S<&global2, [...]>>'
   1161 Wrapper<S<&global2, nullptr>> W8 = MakeWrapper<S<&global, ptr2>>();
   1162 // CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global, [...]>>' to 'Wrapper<S<&global2, [...]>>'
   1163 Wrapper<S<&global2, ptr>> W9 = MakeWrapper<S<&global, ptr2>>();
   1164 // CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global, [...]>>' to 'Wrapper<S<&global2, [...]>>'
   1165 Wrapper<S<&global2, ptr2>> W10 = MakeWrapper<S<&global, ptr>>();
   1166 // CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global, [...]>>' to 'Wrapper<S<&global2, [...]>>'
   1167 Wrapper<S<&global2, static_cast<int *>(0)>> W11 =
   1168     MakeWrapper<S<&global, nullptr>>();
   1169 // CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global, [...]>>' to 'Wrapper<S<&global2, [...]>>'
   1170 Wrapper<S<&global2, nullptr>> W12 =
   1171     MakeWrapper<S<&global, static_cast<int *>(0)>>();
   1172 // CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global, [...]>>' to 'Wrapper<S<&global2, [...]>>'
   1173 
   1174 Wrapper<S<&global, &global>> W13 = MakeWrapper<S<&global, ptr>>();
   1175 // CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<[...], nullptr>>' to 'Wrapper<S<[...], &global>>'
   1176 Wrapper<S<&global, ptr>> W14 = MakeWrapper<S<&global, &global>>();
   1177 // CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<[...], &global>>' to 'Wrapper<S<[...], ptr aka nullptr>>'
   1178 }
   1179 
   1180 namespace TemplateTemplateDefault {
   1181 template <class> class A{};
   1182 template <class> class B{};
   1183 template <class> class C{};
   1184 template <template <class> class, template <class> class = A>
   1185         class T {};
   1186 
   1187 T<A> t1 = T<A, C>();
   1188 // CHECK-ELIDE-NOTREE: no viable conversion from 'T<[...], template C>' to 'T<[...], (default) template A>'
   1189 T<A, C> t2 = T<A>();
   1190 // CHECK-ELIDE-NOTREE: no viable conversion from 'T<[...], (default) template A>' to 'T<[...], template C>'
   1191 T<A> t3 = T<B>();
   1192 // CHECK-ELIDE-NOTREE: no viable conversion from 'T<template B>' to 'T<template A>'
   1193 T<B, C> t4 = T<C, B>();
   1194 // CHECK-ELIDE-NOTREE: no viable conversion from 'T<template C, template B>' to 'T<template B, template C>'
   1195 T<A, A> t5 = T<B>();
   1196 // CHECK-ELIDE-NOTREE: no viable conversion from 'T<template B, [...]>' to 'T<template A, [...]>'
   1197 T<B> t6 = T<A, A>();
   1198 // CHECK-ELIDE-NOTREE: no viable conversion from 'T<template A, [...]>' to 'T<template B, [...]>'
   1199 }
   1200 
   1201 namespace Bool {
   1202 template <class> class A{};
   1203 A<bool> a1 = A<int>();
   1204 // CHECK-ELIDE-NOTREE: no viable conversion from 'A<int>' to 'A<bool>'
   1205 A<int> a2 = A<bool>();
   1206 // CHECK-ELIDE-NOTREE: no viable conversion from 'A<bool>' to 'A<int>'
   1207 }
   1208 
   1209 namespace TypeAlias {
   1210 template <int, int = 0> class A {};
   1211 
   1212 template <class T> using a = A<T::num, 0>;
   1213 template <class T> using a = A<T::num>;
   1214 
   1215 template <class T> using A1 = A<T::num>;
   1216 template <class T> using A1 = A<T::num + 0>;
   1217 // CHECK-ELIDE-NOTREE: type alias template redefinition with different types ('A<T::num + 0>' vs 'A<T::num>')
   1218 
   1219 template <class T> using A2 = A<1 + T::num>;
   1220 template <class T> using A2 = A<T::num + 1>;
   1221 // CHECK-ELIDE-NOTREE: type alias template redefinition with different types ('A<T::num + 1>' vs 'A<1 + T::num>')
   1222 
   1223 template <class T> using A3 = A<(T::num)>;
   1224 template <class T> using A3 = A<T::num>;
   1225 // CHECK-ELIDE-NOTREE: error: type alias template redefinition with different types ('A<T::num>' vs 'A<(T::num)>')
   1226 
   1227           template <class T> using A4 = A<(T::num)>;
   1228 template <class T> using A4 = A<((T::num))>;
   1229 // CHECK-ELIDE-NOTREE: type alias template redefinition with different types ('A<((T::num))>' vs 'A<(T::num)>')
   1230 
   1231 template <class T> using A5 = A<T::num, 1>;
   1232 template <class T> using A5 = A<T::num>;
   1233 // CHECK-ELIDE-NOTREE: type alias template redefinition with different types ('A<[...], (default) 0>' vs 'A<[...], 1>')
   1234 
   1235 template <class T> using A6 = A<T::num + 5, 1>;
   1236 template <class T> using A6 = A<T::num + 5>;
   1237 // CHECK-ELIDE-NOTREE: type alias template redefinition with different types ('A<[...], (default) 0>' vs 'A<[...], 1>')
   1238 
   1239 template <class T> using A7 = A<T::num, 1>;
   1240 template <class T> using A7 = A<(T::num)>;
   1241 // CHECK-ELIDE-NOTREE: type alias template redefinition with different types ('A<(T::num), (default) 0>' vs 'A<T::num, 1>')
   1242 }
   1243 
   1244 namespace TemplateArgumentImplicitConversion {
   1245 template <int X> struct condition {};
   1246 
   1247 struct is_const {
   1248     constexpr operator int() const { return 10; }
   1249 };
   1250 
   1251 using T = condition<(is_const())>;
   1252 void foo(const T &t) {
   1253   T &t2 = t;
   1254 }
   1255 // CHECK-ELIDE-NOTREE: binding value of type 'const condition<...>' to reference to type 'condition<...>' drops 'const' qualifier
   1256 }
   1257 
   1258 namespace BoolArgumentBitExtended {
   1259 template <bool B> struct BoolT {};
   1260 
   1261 template <typename T> void foo(T) {}
   1262 
   1263 void test() {
   1264   BoolT<false> X;
   1265   foo<BoolT<true>>(X);
   1266 }
   1267 // CHECK-ELIDE-NOTREE: no matching function for call to 'foo'
   1268 // CHECK-ELIDE-NOTREE: candidate function [with T = BoolArgumentBitExtended::BoolT<true>] not viable: no known conversion from 'BoolT<false>' to 'BoolT<true>' for 1st argument
   1269 }
   1270 
   1271 namespace DifferentIntegralTypes {
   1272 template<typename T, T n>
   1273 class A{};
   1274 void foo() {
   1275   A<int, 1> a1 = A<long long, 1>();
   1276   A<unsigned int, 1> a2 = A<int, 5>();
   1277   A<bool, true> a3 = A<signed char, true>();
   1278 }
   1279 // CHECK-ELIDE-NOTREE: error: no viable conversion from 'A<long long, (long long) 1>' to 'A<int, (int) 1>'
   1280 // CHECK-ELIDE-NOTREE: error: no viable conversion from 'A<int, (int) 5>' to 'A<unsigned int, (unsigned int) 1>'
   1281 // CHECK-ELIDE-NOTREE: error: no viable conversion from 'A<signed char, (signed char) 1>' to 'A<bool, (bool) true>'
   1282 }
   1283 
   1284 namespace MixedDeclarationIntegerArgument {
   1285 template<typename T, T n> class A{};
   1286 int x;
   1287 int y[5];
   1288 
   1289 A<int, 5> a1 = A<int&, x>();
   1290 A<int, 5 - 1> a2 = A<int*, &x>();
   1291 A<int, 5 + 1> a3 = A<int*, y>();
   1292 A<int, 0> a4 = A<int**, nullptr>();
   1293 // CHECK-ELIDE-NOTREE: error: no viable conversion from 'A<int &, x>' to 'A<int, 5>'
   1294 // CHECK-ELIDE-NOTREE: error: no viable conversion from 'A<int *, &x>' to 'A<int, 5 - 1 aka 4>'
   1295 // CHECK-ELIDE-NOTREE: error: no viable conversion from 'A<int *, y>' to 'A<int, 5 + 1 aka 6>'
   1296 // CHECK-ELIDE-NOTREE: error: no viable conversion from 'A<int **, nullptr>' to 'A<int, 0>'
   1297 // CHECK-ELIDE-TREE: error: no viable conversion
   1298 // CHECK-ELIDE-TREE:   A<
   1299 // CHECK-ELIDE-TREE:     [int & != int],
   1300 // CHECK-ELIDE-TREE:     [x != 5]>
   1301 // CHECK-ELIDE-TREE: error: no viable conversion
   1302 // CHECK-ELIDE-TREE:   A<
   1303 // CHECK-ELIDE-TREE:     [int * != int],
   1304 // CHECK-ELIDE-TREE:     [&x != 5 - 1 aka 4]>
   1305 // CHECK-ELIDE-TREE: error: no viable conversion
   1306 // CHECK-ELIDE-TREE:   A<
   1307 // CHECK-ELIDE-TREE:     [int * != int],
   1308 // CHECK-ELIDE-TREE:     [y != 5 + 1 aka 6]>
   1309 // CHECK-ELIDE-TREE: error: no viable conversion
   1310 // CHECK-ELIDE-TREE:   A<
   1311 // CHECK-ELIDE-TREE:     [int ** != int],
   1312 // CHECK-ELIDE-TREE:     [nullptr != 0]>
   1313 
   1314 A<int&, x> a5 = A<int, 3>();
   1315 A<int*, &x> a6 = A<int, 3 - 1>();
   1316 A<int*, y> a7 = A<int, 3 + 1>();
   1317 A<int**, nullptr> a8 = A<int, 3>();
   1318 // CHECK-ELIDE-NOTREE: error: no viable conversion from 'A<int, 3>' to 'A<int &, x>'
   1319 // CHECK-ELIDE-NOTREE: error: no viable conversion from 'A<int, 3 - 1 aka 2>' to 'A<int *, &x>'
   1320 // CHECK-ELIDE-NOTREE: error: no viable conversion from 'A<int, 3 + 1 aka 4>' to 'A<int *, y>'
   1321 // CHECK-ELIDE-NOTREE: error: no viable conversion from 'A<int, 3>' to 'A<int **, nullptr>'
   1322 // CHECK-ELIDE-TREE: error: no viable conversion
   1323 // CHECK-ELIDE-TREE:   A<
   1324 // CHECK-ELIDE-TREE:     [int != int &],
   1325 // CHECK-ELIDE-TREE:     [3 != x]>
   1326 // CHECK-ELIDE-TREE: error: no viable conversion
   1327 // CHECK-ELIDE-TREE:   A<
   1328 // CHECK-ELIDE-TREE:     [int != int *],
   1329 // CHECK-ELIDE-TREE:     [3 - 1 aka 2 != &x]>
   1330 // CHECK-ELIDE-TREE: error: no viable conversion
   1331 // CHECK-ELIDE-TREE:   A<
   1332 // CHECK-ELIDE-TREE:     [int != int *],
   1333 // CHECK-ELIDE-TREE:     [3 + 1 aka 4 != y]>
   1334 // CHECK-ELIDE-TREE: error: no viable conversion
   1335 // CHECK-ELIDE-TREE:   A<
   1336 // CHECK-ELIDE-TREE:     [int != int **],
   1337 // CHECK-ELIDE-TREE:     [3 != nullptr]>
   1338 
   1339 template<class T, T n = x> class B{} ;
   1340 B<int, 5> b1 = B<int&>();
   1341 // CHECK-ELIDE-NOTREE: error: no viable conversion from 'B<int &, (default) x>' to 'B<int, 5>'
   1342 // CHECK-ELIDE-TREE: error: no viable conversion
   1343 // CHECK-ELIDE-TREE:   B<
   1344 // CHECK-ELIDE-TREE:     [int & != int],
   1345 // CHECK-ELIDE-TREE:     [(default) x != 5]>
   1346 
   1347 B<int &> b2 = B<int, 2>();
   1348 // CHECK-ELIDE-NOTREE: error: no viable conversion from 'B<int, 2>' to 'B<int &, (default) x>'
   1349 // CHECK-ELIDE-TREE:   B<
   1350 // CHECK-ELIDE-TREE:     [int != int &],
   1351 // CHECK-ELIDE-TREE:     [2 != (default) x]>
   1352 
   1353 template<class T, T n = 11> class C {};
   1354 C<int> c1 = C<int&, x>();
   1355 // CHECK-ELIDE-NOTREE: error: no viable conversion from 'C<int &, x>' to 'C<int, (default) 11>'
   1356 // CHECK-ELIDE-TREE: error: no viable conversion
   1357 // CHECK-ELIDE-TREE:   C<
   1358 // CHECK-ELIDE-TREE:     [int & != int],
   1359 // CHECK-ELIDE-TREE:     [x != (default) 11]>
   1360 
   1361 C<int &, x> c2 = C<int>();
   1362 // CHECK-ELIDE-NOTREE: error: no viable conversion from 'C<int, (default) 11>' to 'C<int &, x>'
   1363 // CHECK-ELIDE-TREE:   C<
   1364 // CHECK-ELIDE-TREE:     [int != int &],
   1365 // CHECK-ELIDE-TREE:     [(default) 11 != x]>
   1366 }
   1367 
   1368 namespace default_args {
   1369   template <int x, int y = 1+1, int z = 2>
   1370   class A {};
   1371 
   1372   void foo(A<0> &M) {
   1373     // CHECK-ELIDE-NOTREE: no viable conversion from 'A<[...], (default) 1 + 1 aka 2, (default) 2>' to 'A<[...], 0, 0>'
   1374     A<0, 0, 0> N = M;
   1375 
   1376     // CHECK-ELIDE-NOTREE: no viable conversion from 'A<[2 * ...], (default) 2>' to 'A<[2 * ...], 0>'
   1377     A<0, 2, 0> N2 = M;
   1378   }
   1379 }
   1380 
   1381 namespace DefaultNonTypeArgWithDependentType {
   1382 // We used to crash diffing integer template arguments when the argument type
   1383 // is dependent and default arguments were used.
   1384 template <typename SizeType = int, SizeType = 0> struct A {};
   1385 template <typename R = A<>> R bar();
   1386 A<> &foo() { return bar(); }
   1387 // CHECK-ELIDE-NOTREE: error: non-const lvalue reference to type 'A<...>' cannot bind to a temporary of type 'A<...>'
   1388 // CHECK-NOELIDE-NOTREE: error: non-const lvalue reference to type 'A<int, 0>' cannot bind to a temporary of type 'A<int, 0>'
   1389 }
   1390 
   1391 namespace PR24587 {
   1392 template <typename T, T v>
   1393 struct integral_constant {};
   1394 
   1395 auto false_ = integral_constant<bool, false> {};
   1396 
   1397 template <typename T>
   1398 void f(T, decltype(false_));
   1399 
   1400 void run() {
   1401   f(1, integral_constant<bool, true>{});
   1402 }
   1403 // CHECK-ELIDE-NOTREE: error: no matching function for call to 'f'
   1404 // CHECK-ELIDE-NOTREE: note: candidate function [with T = int] not viable: no known conversion from 'integral_constant<[...], true>' to 'integral_constant<[...], false>' for 2nd argument
   1405 }
   1406 
   1407 namespace ZeroArgs {
   1408 template <int N = 0> class A {};
   1409 template <class T = A<>> class B {};
   1410 A<1> a1 = A<>();
   1411 A<> a2 = A<1>();
   1412 B<> b1 = B<int>();
   1413 B<int> b2 = B<>();
   1414 B<> b3 = B<const A<>>();
   1415 B<const A<>> b4 = B<>();
   1416 // CHECK-ELIDE-NOTREE: error: no viable conversion from 'A<(default) 0>' to 'A<1>'
   1417 // CHECK-ELIDE-NOTREE: error: no viable conversion from 'A<1>' to 'A<(default) 0>'
   1418 // CHECK-ELIDE-NOTREE: error: no viable conversion from 'B<int>' to 'B<(default) ZeroArgs::A<0>>'
   1419 // CHECK-ELIDE-NOTREE: error: no viable conversion from 'B<(default) ZeroArgs::A<0>>' to 'B<int>'
   1420 // CHECK-ELIDE-NOTREE: error: no viable conversion from 'B<const A<...>>' to 'B<A<...>>'
   1421 // CHECK-ELIDE-NOTREE: error: no viable conversion from 'B<A<...>>' to 'B<const A<...>>'
   1422 }
   1423 
   1424 namespace TypeAlias {
   1425 
   1426 template <typename T> class vector {};
   1427 
   1428 template <int Dimension> class Point;
   1429 template <int dimension, typename T> using Polygon = vector<Point<dimension>>;
   1430 
   1431 void foo(Polygon<3, float>);
   1432 void bar() { foo(Polygon<2, float>()); }
   1433 
   1434 // CHECK-ELIDE-NOTREE: error: no matching function for call to 'foo'
   1435 // CHECK-ELIDE-NOTREE: note: candidate function not viable: no known conversion from 'Polygon<2, [...]>' to 'Polygon<3, [...]>' for 1st argument
   1436 
   1437 enum class X {
   1438   X1,
   1439   X2,
   1440 };
   1441 
   1442 template<X x> struct EnumToType;
   1443 
   1444 template <> struct EnumToType<X::X1> { using type = int; };
   1445 
   1446 template <> struct EnumToType<X::X2> { using type = double; };
   1447 
   1448 
   1449 template <X x> using VectorType = vector<typename EnumToType<x>::type>;
   1450 
   1451 template <X x> void D(const VectorType<x>&);
   1452 
   1453 void run() {
   1454   D<X::X1>(VectorType<X::X2>());
   1455 }
   1456 // CHECK-ELIDE-NOTREE: error: no matching function for call to 'D'
   1457 // CHECK-ELIDE-NOTREE: note: candidate function [with x = TypeAlias::X::X1] not viable: no known conversion from 'VectorType<X::X2>' to 'const VectorType<(TypeAlias::X)0>' for 1st argument
   1458 
   1459 }
   1460 
   1461 // CHECK-ELIDE-NOTREE: {{[0-9]*}} errors generated.
   1462 // CHECK-NOELIDE-NOTREE: {{[0-9]*}} errors generated.
   1463 // CHECK-ELIDE-TREE: {{[0-9]*}} errors generated.
   1464 // CHECK-NOELIDE-TREE: {{[0-9]*}} errors generated.
   1465