| 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 * ...], U9<double>>' to 'S9<[2 * ...], U9<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, U9<double>>' to 'S9<int, char, U9<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: 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 argument |
| 271 |
// 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 |
|
| 277 |
template<typename ...A> class class_types {}; |
| 278 |
void set10(class_types<int, int>) {} |
| 279 |
void 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 argument |
| 286 |
// 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 argument |
| 288 |
// 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 argument |
| 290 |
// 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 argument |
| 292 |
// 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 argument |
| 294 |
// 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 argument |
| 299 |
// 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 argument |
| 304 |
// 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 argument |
| 309 |
// CHECK-NOELIDE-TREE: class_types< |
| 310 |
// CHECK-NOELIDE-TREE: int, |
| 311 |
// CHECK-NOELIDE-TREE: int, |
| 312 |
// CHECK-NOELIDE-TREE: [int != (no argument)]> |
| 313 |
|
| 314 |
template<int ...A> class class_ints {}; |
| 315 |
void set11(class_ints<2, 3>) {} |
| 316 |
void 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 argument |
| 322 |
// 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 argument |
| 324 |
// 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 argument |
| 326 |
// 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 argument |
| 328 |
// 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 argument |
| 330 |
// 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 argument |
| 335 |
// 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 argument |
| 341 |
// 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 argument |
| 346 |
// CHECK-NOELIDE-TREE: class_ints< |
| 347 |
// CHECK-NOELIDE-TREE: [0 != 2], |
| 348 |
// CHECK-NOELIDE-TREE: 3, |
| 349 |
// CHECK-NOELIDE-TREE: [6 != (no argument)]> |
| 350 |
|
| 351 |
template<template<class> class ...A> class class_template_templates {}; |
| 352 |
template<class> class tt1 {}; |
| 353 |
template<class> class tt2 {}; |
| 354 |
void set12(class_template_templates<tt1, tt1>) {} |
| 355 |
void 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 argument |
| 361 |
// 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 argument |
| 363 |
// 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 argument |
| 365 |
// 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 argument |
| 367 |
// 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 argument |
| 369 |
// 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 argument |
| 374 |
// 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 argument |
| 379 |
// 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 argument |
| 384 |
// 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 |
|
| 389 |
double a13, b13, c13, d13; |
| 390 |
template<double* ...A> class class_ptrs {}; |
| 391 |
void set13(class_ptrs<&a13, &b13>) {} |
| 392 |
void 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 argument |
| 398 |
// 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 argument |
| 400 |
// 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 argument |
| 402 |
// 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 argument |
| 404 |
// 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 argument |
| 406 |
// 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 argument |
| 411 |
// 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 argument |
| 416 |
// 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 argument |
| 421 |
// CHECK-NOELIDE-TREE: class_ptrs< |
| 422 |
// CHECK-NOELIDE-TREE: &a13, |
| 423 |
// CHECK-NOELIDE-TREE: &b13, |
| 424 |
// CHECK-NOELIDE-TREE: [&d13 != (no argument)]> |
| 425 |
|
| 426 |
template<typename T> struct s14 {}; |
| 427 |
template<typename T> using a14 = s14<T>; |
| 428 |
typedef a14<int> b14; |
| 429 |
template<typename T> using c14 = b14; |
| 430 |
int f14(c14<int>); |
| 431 |
int 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 argument |
| 434 |
// 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 argument |
| 436 |
// 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 argument |
| 438 |
// 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 argument |
| 442 |
// CHECK-NOELIDE-TREE: a14< |
| 443 |
// CHECK-NOELIDE-TREE: [char != int]> |
| 444 |
|
| 445 |
void set15(vector<vector<int>>) {} |
| 446 |
void test15() { |
| 447 |
set15(vector<vector<int>>()); |
| 448 |
} |
| 449 |
// CHECK-ELIDE-NOTREE-NOT: set15 |
| 450 |
// CHECK-NOELIDE-NOTREE-NOT: set15 |
| 451 |
// CHECK-ELIDE-TREE-NOT: set15 |
| 452 |
// CHECK-NOELIDE-TREE-NOT: set15 |
| 453 |
// no error here |
| 454 |
|
| 455 |
void set16(vector<const vector<int>>) {} |
| 456 |
void 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 argument |
| 461 |
// 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 argument |
| 463 |
// 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 argument |
| 465 |
// 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 argument |
| 470 |
// CHECK-NOELIDE-TREE: vector< |
| 471 |
// CHECK-NOELIDE-TREE: const vector< |
| 472 |
// CHECK-NOELIDE-TREE: [const != (no qualifiers)] int>> |
| 473 |
|
| 474 |
void set17(vector<vector<int>>) {} |
| 475 |
void 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 argument |
| 480 |
// 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 argument |
| 482 |
// 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 argument |
| 484 |
// 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 argument |
| 488 |
// CHECK-NOELIDE-TREE: vector< |
| 489 |
// CHECK-NOELIDE-TREE: [const != (no qualifiers)] vector< |
| 490 |
// CHECK-NOELIDE-TREE: int>> |
| 491 |
|
| 492 |
void set18(vector<const vector<int>>) {} |
| 493 |
void 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 argument |
| 498 |
// 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 argument |
| 500 |
// 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 argument |
| 502 |
// 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 argument |
| 506 |
// CHECK-NOELIDE-TREE: vector< |
| 507 |
// CHECK-NOELIDE-TREE: [(no qualifiers) != const] vector< |
| 508 |
// CHECK-NOELIDE-TREE: int>> |
| 509 |
|
| 510 |
void set19(vector<volatile vector<int>>) {} |
| 511 |
void 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 argument |
| 516 |
// 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 argument |
| 518 |
// 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 argument |
| 520 |
// 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 argument |
| 524 |
// CHECK-NOELIDE-TREE: vector< |
| 525 |
// CHECK-NOELIDE-TREE: [const != volatile] vector< |
| 526 |
// CHECK-NOELIDE-TREE: int>> |
| 527 |
|
| 528 |
void set20(vector<const volatile vector<int>>) {} |
| 529 |
void 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 argument |
| 534 |
// 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 argument |
| 536 |
// 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 argument |
| 538 |
// 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 argument |
| 542 |
// 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. |
| 548 |
template<typename T> struct S21 {}; |
| 549 |
template<typename T> using U21 = volatile S21<T>; |
| 550 |
int f21(vector<const U21<int>>); |
| 551 |
int 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 argument |
| 554 |
// 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 argument |
| 556 |
// 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 argument |
| 558 |
// 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 argument |
| 562 |
// 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. |
| 567 |
template<typename T> struct S22 {}; |
| 568 |
template<typename T> using U22 = volatile S22<T>; |
| 569 |
int f22(vector<volatile const U22<int>>); |
| 570 |
int 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 argument |
| 573 |
// 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 argument |
| 575 |
// 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 argument |
| 577 |
// 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 argument |
| 581 |
// CHECK-NOELIDE-TREE: vector< |
| 582 |
// CHECK-NOELIDE-TREE: [(no qualifiers) != const] U22< |
| 583 |
// CHECK-NOELIDE-TREE: int>> |
| 584 |
|
| 585 |
// Testing qualifiers and typedefs. |
| 586 |
template <class T> struct D23{}; |
| 587 |
template <class T> using C23 = D23<T>; |
| 588 |
typedef const C23<int> B23; |
| 589 |
template<class ...T> using A23 = B23; |
| 590 |
|
| 591 |
void foo23(D23<A23<>> b) {} |
| 592 |
void 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 argument |
| 599 |
// 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 argument |
| 601 |
// 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 argument |
| 603 |
// 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 argument |
| 605 |
// 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 argument |
| 607 |
// 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 argument |
| 612 |
// 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 argument |
| 616 |
// 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 argument |
| 621 |
// CHECK-NOELIDE-TREE: D23< |
| 622 |
// CHECK-NOELIDE-TREE: [char != A23<>]> |
| 623 |
|
| 624 |
namespace PR14015 { |
| 625 |
template <unsigned N> class Foo1 {}; |
| 626 |
template <unsigned N = 2> class Foo2 {}; |
| 627 |
template <unsigned ...N> class Foo3 {}; |
| 628 |
|
| 629 |
void 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 argument |
| 640 |
// CHECK-ELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo1<1>' to 'Foo1<2>' for 1st argument |
| 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<2>' to 'const Foo1<1>' for 1st argument |
| 643 |
// CHECK-ELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo1<2>' to 'Foo1<1>' for 1st argument |
| 644 |
// 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 argument |
| 646 |
// CHECK-NOELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo1<1>' to 'Foo1<2>' 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<2>' to 'const Foo1<1>' for 1st argument |
| 649 |
// CHECK-NOELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo1<2>' to 'Foo1<1>' for 1st argument |
| 650 |
// 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 argument |
| 652 |
// 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 argument |
| 655 |
// 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 argument |
| 659 |
// 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 argument |
| 662 |
// 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 argument |
| 666 |
// 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 argument |
| 669 |
// 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 argument |
| 673 |
// 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 argument |
| 676 |
// CHECK-NOELIDE-TREE: Foo1< |
| 677 |
// CHECK-NOELIDE-TREE: [2 != 1]> |
| 678 |
|
| 679 |
void 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 argument |
| 689 |
// CHECK-ELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo2<1>' to 'Foo2<2>' for 1st argument |
| 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<(default) 2>' to 'const Foo2<1>' for 1st argument |
| 692 |
// 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 |
| 693 |
// 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 argument |
| 695 |
// CHECK-NOELIDE-NOTREE: candidate function (the implicit move assignment operator) not viable: no known conversion from 'Foo2<1>' to 'Foo2<2>' 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<(default) 2>' to 'const Foo2<1>' for 1st argument |
| 698 |
// 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 |
| 699 |
// 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 argument |
| 701 |
// 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 argument |
| 704 |
// 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 argument |
| 708 |
// 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 argument |
| 711 |
// 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 argument |
| 715 |
// 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 argument |
| 718 |
// 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 argument |
| 722 |
// 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 argument |
| 725 |
// CHECK-NOELIDE-TREE: Foo2< |
| 726 |
// CHECK-NOELIDE-TREE: [(default) 2 != 1]> |
| 727 |
|
| 728 |
void 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 argument |
| 738 |
// 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 |
| 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<2, 1>' to 'const Foo3<1, (no argument)>' for 1st argument |
| 741 |
// 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 |
| 742 |
// 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 argument |
| 744 |
// 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 |
| 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<2, 1>' to 'const Foo3<1, (no argument)>' for 1st argument |
| 747 |
// 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 |
| 748 |
// 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 argument |
| 750 |
// 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 argument |
| 754 |
// 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 argument |
| 759 |
// 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 argument |
| 763 |
// 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 argument |
| 768 |
// 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 argument |
| 772 |
// 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 argument |
| 777 |
// 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 argument |
| 781 |
// CHECK-NOELIDE-TREE: Foo3< |
| 782 |
// CHECK-NOELIDE-TREE: [2 != 1], |
| 783 |
// CHECK-NOELIDE-TREE: [1 != (no argument)]> |
| 784 |
} |
| 785 |
|
| 786 |
namespace 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 |
|
| 794 |
namespace PR14489 { |
| 795 |
// The important thing here is that the diagnostic diffs a template specialization |
| 796 |
// with no arguments against itself. (We might need a different test if this |
| 797 |
// 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 |
|
| 806 |
namespace 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 type |
| 820 |
virtual X<IntWrapper, 2> foo(); |
| 821 |
}; |
| 822 |
} |
| 823 |
|
| 824 |
namespace 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 |
|
| 839 |
namespace 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 |
|
| 863 |
namespace 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 |
|
| 897 |
namespace 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 |
|
| 952 |
namespace 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 |
|
| 996 |
namespace 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 argument |
| 1007 |
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 argument |
| 1010 |
|
| 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 argument |
| 1015 |
|
| 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 argument |
| 1019 |
|
| 1020 |
} |
| 1021 |
} |
| 1022 |
|
| 1023 |
namespace 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 |
|
| 1045 |
namespace PR17510 { |
| 1046 |
class Atom; |
| 1047 |
|
| 1048 |
template <typename T> class allocator; |
| 1049 |
template <typename T, typename A> class vector; |
| 1050 |
|
| 1051 |
typedef vector<const Atom *, allocator<const Atom *> > AtomVector; |
| 1052 |
|
| 1053 |
template <typename T, typename A = allocator<const Atom *> > class vector {}; |
| 1054 |
|
| 1055 |
void 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 |
|
| 1062 |
namespace PR15677 { |
| 1063 |
template <bool> |
| 1064 |
struct A{}; |
| 1065 |
|
| 1066 |
template <typename T> |
| 1067 |
using B = A<T::value>; |
| 1068 |
|
| 1069 |
template <typename T> |
| 1070 |
using B = A<!T::value>; |
| 1071 |
// CHECK-ELIDE-NOTREE: type alias template redefinition with different types ('A<!T::value>' vs 'A<T::value>') |
| 1072 |
|
| 1073 |
template <int> |
| 1074 |
struct C{}; |
| 1075 |
|
| 1076 |
template <typename T> |
| 1077 |
using D = C<T::value>; |
| 1078 |
|
| 1079 |
template <typename T> |
| 1080 |
using 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 |
|
| 1083 |
template <typename T> |
| 1084 |
using E = C<T::value>; |
| 1085 |
|
| 1086 |
template <typename T> |
| 1087 |
using E = C<42>; |
| 1088 |
// CHECK-ELIDE-NOTREE: type alias template redefinition with different types ('C<42>' vs 'C<T::value>') |
| 1089 |
|
| 1090 |
template <typename T> |
| 1091 |
using F = C<T::value>; |
| 1092 |
|
| 1093 |
template <typename T> |
| 1094 |
using 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 |
|
| 1099 |
namespace AddressOf { |
| 1100 |
template <int*> |
| 1101 |
struct S {}; |
| 1102 |
|
| 1103 |
template <class T> |
| 1104 |
struct Wrapper {}; |
| 1105 |
|
| 1106 |
template <class T> |
| 1107 |
Wrapper<T> MakeWrapper(); |
| 1108 |
int global, global2; |
| 1109 |
constexpr int * ptr = nullptr; |
| 1110 |
Wrapper<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 correctly |
| 1115 |
Wrapper<S<(&global2)>> W2 = MakeWrapper<S<&global>>(); |
| 1116 |
// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global>>' to 'Wrapper<S<&global2>>' |
| 1117 |
Wrapper<S<&global2>> W3 = MakeWrapper<S<(&global)>>(); |
| 1118 |
// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global>>' to 'Wrapper<S<&global2>>' |
| 1119 |
Wrapper<S<(&global2)>> W4 = MakeWrapper<S<(&global)>>(); |
| 1120 |
// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global>>' to 'Wrapper<S<&global2>>' |
| 1121 |
} |
| 1122 |
|
| 1123 |
namespace NullPtr { |
| 1124 |
template <int*, int*> |
| 1125 |
struct S {}; |
| 1126 |
|
| 1127 |
template <class T> |
| 1128 |
struct Wrapper {}; |
| 1129 |
|
| 1130 |
template <class T> |
| 1131 |
Wrapper<T> MakeWrapper(); |
| 1132 |
int global, global2; |
| 1133 |
constexpr int * ptr = nullptr; |
| 1134 |
constexpr int * ptr2 = static_cast<int*>(0); |
| 1135 |
|
| 1136 |
S<&global> s1 = S<&global, ptr>(); |
| 1137 |
S<&global, nullptr> s2 = S<&global, ptr>(); |
| 1138 |
|
| 1139 |
S<&global, nullptr> s3 = S<&global, &global>(); |
| 1140 |
// CHECK-ELIDE-NOTREE: no viable conversion from 'S<[...], &global>' to 'S<[...], nullptr>' |
| 1141 |
S<&global, ptr> s4 = S<&global, &global>(); |
| 1142 |
// CHECK-ELIDE-NOTREE: no viable conversion from 'S<[...], &global>' to 'S<[...], ptr aka nullptr> |
| 1143 |
|
| 1144 |
Wrapper<S<&global, nullptr>> W1 = MakeWrapper<S<&global, ptr>>(); |
| 1145 |
Wrapper<S<&global, static_cast<int*>(0)>> W2 = MakeWrapper<S<&global, ptr>>(); |
| 1146 |
|
| 1147 |
Wrapper<S<&global, nullptr>> W3 = MakeWrapper<S<&global, &global>>(); |
| 1148 |
// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<[...], &global>>' to 'Wrapper<S<[...], nullptr>>' |
| 1149 |
Wrapper<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 |
|
| 1152 |
Wrapper<S<&global2, ptr>> W5 = MakeWrapper<S<&global, nullptr>>(); |
| 1153 |
// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global, [...]>>' to 'Wrapper<S<&global2, [...]>>' |
| 1154 |
Wrapper<S<&global2, nullptr>> W6 = MakeWrapper<S<&global, nullptr>>(); |
| 1155 |
// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global, [...]>>' to 'Wrapper<S<&global2, [...]>>' |
| 1156 |
Wrapper<S<&global2, ptr2>> W7 = MakeWrapper<S<&global, nullptr>>(); |
| 1157 |
// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global, [...]>>' to 'Wrapper<S<&global2, [...]>>' |
| 1158 |
Wrapper<S<&global2, nullptr>> W8 = MakeWrapper<S<&global, ptr2>>(); |
| 1159 |
// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global, [...]>>' to 'Wrapper<S<&global2, [...]>>' |
| 1160 |
Wrapper<S<&global2, ptr>> W9 = MakeWrapper<S<&global, ptr2>>(); |
| 1161 |
// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global, [...]>>' to 'Wrapper<S<&global2, [...]>>' |
| 1162 |
Wrapper<S<&global2, ptr2>> W10 = MakeWrapper<S<&global, ptr>>(); |
| 1163 |
// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<&global, [...]>>' to 'Wrapper<S<&global2, [...]>>' |
| 1164 |
Wrapper<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, [...]>>' |
| 1167 |
Wrapper<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 |
|
| 1171 |
Wrapper<S<&global, &global>> W13 = MakeWrapper<S<&global, ptr>>(); |
| 1172 |
// CHECK-ELIDE-NOTREE: no viable conversion from 'Wrapper<S<[...], nullptr>>' to 'Wrapper<S<[...], &global>>' |
| 1173 |
Wrapper<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 |
|
| 1177 |
namespace TemplateTemplateDefault { |
| 1178 |
template <class> class A{}; |
| 1179 |
template <class> class B{}; |
| 1180 |
template <class> class C{}; |
| 1181 |
template <template <class> class, template <class> class = A> |
| 1182 |
class T {}; |
| 1183 |
|
| 1184 |
T<A> t1 = T<A, C>(); |
| 1185 |
// CHECK-ELIDE-NOTREE: no viable conversion from 'T<[...], template C>' to 'T<[...], (default) template A>' |
| 1186 |
T<A, C> t2 = T<A>(); |
| 1187 |
// CHECK-ELIDE-NOTREE: no viable conversion from 'T<[...], (default) template A>' to 'T<[...], template C>' |
| 1188 |
T<A> t3 = T<B>(); |
| 1189 |
// CHECK-ELIDE-NOTREE: no viable conversion from 'T<template B>' to 'T<template A>' |
| 1190 |
T<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>' |
| 1192 |
T<A, A> t5 = T<B>(); |
| 1193 |
// CHECK-ELIDE-NOTREE: no viable conversion from 'T<template B, [...]>' to 'T<template A, [...]>' |
| 1194 |
T<B> t6 = T<A, A>(); |
| 1195 |
// CHECK-ELIDE-NOTREE: no viable conversion from 'T<template A, [...]>' to 'T<template B, [...]>' |
| 1196 |
} |
| 1197 |
|
| 1198 |
namespace Bool { |
| 1199 |
template <class> class A{}; |
| 1200 |
A<bool> a1 = A<int>(); |
| 1201 |
// CHECK-ELIDE-NOTREE: no viable conversion from 'A<int>' to 'A<bool>' |
| 1202 |
A<int> a2 = A<bool>(); |
| 1203 |
// CHECK-ELIDE-NOTREE: no viable conversion from 'A<bool>' to 'A<int>' |
| 1204 |
} |
| 1205 |
|
| 1206 |
namespace TypeAlias { |
| 1207 |
template <int, int = 0> class A {}; |
| 1208 |
|
| 1209 |
template <class T> using a = A<T::num, 0>; |
| 1210 |
template <class T> using a = A<T::num>; |
| 1211 |
|
| 1212 |
template <class T> using A1 = A<T::num>; |
| 1213 |
template <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 |
|
| 1216 |
template <class T> using A2 = A<1 + T::num>; |
| 1217 |
template <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 |
|
| 1220 |
template <class T> using A3 = A<(T::num)>; |
| 1221 |
template <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)>; |
| 1225 |
template <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 |
|
| 1228 |
template <class T> using A5 = A<T::num, 1>; |
| 1229 |
template <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 |
|
| 1232 |
template <class T> using A6 = A<T::num + 5, 1>; |
| 1233 |
template <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 |
|
| 1236 |
template <class T> using A7 = A<T::num, 1>; |
| 1237 |
template <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 |
|
| 1241 |
namespace TemplateArgumentImplicitConversion { |
| 1242 |
template <int X> struct condition {}; |
| 1243 |
|
| 1244 |
struct is_const { |
| 1245 |
constexpr operator int() const { return 10; } |
| 1246 |
}; |
| 1247 |
|
| 1248 |
using T = condition<(is_const())>; |
| 1249 |
void 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' qualifier |
| 1253 |
} |
| 1254 |
|
| 1255 |
namespace BoolArgumentBitExtended { |
| 1256 |
template <bool B> struct BoolT {}; |
| 1257 |
|
| 1258 |
template <typename T> void foo(T) {} |
| 1259 |
|
| 1260 |
void 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 argument |
| 1266 |
} |
| 1267 |
|
| 1268 |
namespace DifferentIntegralTypes { |
| 1269 |
template<typename T, T n> |
| 1270 |
class A{}; |
| 1271 |
void 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 |
|
| 1281 |
namespace MixedDeclarationIntegerArgument { |
| 1282 |
template<typename T, T n> class A{}; |
| 1283 |
int x; |
| 1284 |
int y[5]; |
| 1285 |
|
| 1286 |
A<int, 5> a1 = A<int&, x>(); |
| 1287 |
A<int, 5 - 1> a2 = A<int*, &x>(); |
| 1288 |
A<int, 5 + 1> a3 = A<int*, y>(); |
| 1289 |
A<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 conversion |
| 1295 |
// CHECK-ELIDE-TREE: A< |
| 1296 |
// CHECK-ELIDE-TREE: [int & != int], |
| 1297 |
// CHECK-ELIDE-TREE: [x != 5]> |
| 1298 |
// CHECK-ELIDE-TREE: error: no viable conversion |
| 1299 |
// 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 conversion |
| 1303 |
// 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 conversion |
| 1307 |
// CHECK-ELIDE-TREE: A< |
| 1308 |
// CHECK-ELIDE-TREE: [int ** != int], |
| 1309 |
// CHECK-ELIDE-TREE: [nullptr != 0]> |
| 1310 |
|
| 1311 |
A<int&, x> a5 = A<int, 3>(); |
| 1312 |
A<int*, &x> a6 = A<int, 3 - 1>(); |
| 1313 |
A<int*, y> a7 = A<int, 3 + 1>(); |
| 1314 |
A<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 conversion |
| 1320 |
// CHECK-ELIDE-TREE: A< |
| 1321 |
// CHECK-ELIDE-TREE: [int != int &], |
| 1322 |
// CHECK-ELIDE-TREE: [3 != x]> |
| 1323 |
// CHECK-ELIDE-TREE: error: no viable conversion |
| 1324 |
// 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 conversion |
| 1328 |
// 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 conversion |
| 1332 |
// CHECK-ELIDE-TREE: A< |
| 1333 |
// CHECK-ELIDE-TREE: [int != int **], |
| 1334 |
// CHECK-ELIDE-TREE: [3 != nullptr]> |
| 1335 |
|
| 1336 |
template<class T, T n = x> class B{} ; |
| 1337 |
B<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 conversion |
| 1340 |
// CHECK-ELIDE-TREE: B< |
| 1341 |
// CHECK-ELIDE-TREE: [int & != int], |
| 1342 |
// CHECK-ELIDE-TREE: [(default) x != 5]> |
| 1343 |
|
| 1344 |
B<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 |
|
| 1350 |
template<class T, T n = 11> class C {}; |
| 1351 |
C<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 conversion |
| 1354 |
// CHECK-ELIDE-TREE: C< |
| 1355 |
// CHECK-ELIDE-TREE: [int & != int], |
| 1356 |
// CHECK-ELIDE-TREE: [x != (default) 11]> |
| 1357 |
|
| 1358 |
C<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 |
|
| 1365 |
namespace 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 |
|
| 1378 |
namespace DefaultNonTypeArgWithDependentType { |
| 1379 |
// We used to crash diffing integer template arguments when the argument type |
| 1380 |
// is dependent and default arguments were used. |
| 1381 |
template <typename SizeType = int, SizeType = 0> struct A {}; |
| 1382 |
template <typename R = A<>> R bar(); |
| 1383 |
A<> &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 |
|
| 1388 |
namespace PR24587 { |
| 1389 |
template <typename T, T v> |
| 1390 |
struct integral_constant {}; |
| 1391 |
|
| 1392 |
auto false_ = integral_constant<bool, false> {}; |
| 1393 |
|
| 1394 |
template <typename T> |
| 1395 |
void f(T, decltype(false_)); |
| 1396 |
|
| 1397 |
void 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 argument |
| 1402 |
} |
| 1403 |
|
| 1404 |
namespace ZeroArgs { |
| 1405 |
template <int N = 0> class A {}; |
| 1406 |
template <class T = A<>> class B {}; |
| 1407 |
A<1> a1 = A<>(); |
| 1408 |
A<> a2 = A<1>(); |
| 1409 |
B<> b1 = B<int>(); |
| 1410 |
B<int> b2 = B<>(); |
| 1411 |
B<> b3 = B<const A<>>(); |
| 1412 |
B<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 |
|
| 1421 |
namespace TypeAlias { |
| 1422 |
|
| 1423 |
template <typename T> class vector {}; |
| 1424 |
|
| 1425 |
template <int Dimension> class Point; |
| 1426 |
template <int dimension, typename T> using Polygon = vector<Point<dimension>>; |
| 1427 |
|
| 1428 |
void foo(Polygon<3, float>); |
| 1429 |
void 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 argument |
| 1433 |
|
| 1434 |
enum class X { |
| 1435 |
X1, |
| 1436 |
X2, |
| 1437 |
}; |
| 1438 |
|
| 1439 |
template<X x> struct EnumToType; |
| 1440 |
|
| 1441 |
template <> struct EnumToType<X::X1> { using type = int; }; |
| 1442 |
|
| 1443 |
template <> struct EnumToType<X::X2> { using type = double; }; |
| 1444 |
|
| 1445 |
|
| 1446 |
template <X x> using VectorType = vector<typename EnumToType<x>::type>; |
| 1447 |
|
| 1448 |
template <X x> void D(const VectorType<x>&); |
| 1449 |
|
| 1450 |
void 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 argument |
| 1455 |
} |
| 1456 |
|
| 1457 |
namespace TypeAlias2 { |
| 1458 |
template <typename T> |
| 1459 |
class A {}; |
| 1460 |
|
| 1461 |
template <typename T> |
| 1462 |
using A_reg = A<T>; |
| 1463 |
void take_reg(A_reg<int>); |
| 1464 |
|
| 1465 |
template <typename T> |
| 1466 |
using A_ptr = A<T> *; |
| 1467 |
void take_ptr(A_ptr<int>); |
| 1468 |
|
| 1469 |
template <typename T> |
| 1470 |
using A_ref = const A<T> &; |
| 1471 |
void take_ref(A_ref<int>); |
| 1472 |
|
| 1473 |
void 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 argument |
| 1477 |
|
| 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 argument |
| 1481 |
|
| 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 argument |
| 1485 |
} |
| 1486 |
} |
| 1487 |
|
| 1488 |
namespace SubstTemplateTypeParmType { |
| 1489 |
template <typename T> |
| 1490 |
class Array {}; |
| 1491 |
|
| 1492 |
template <class T> |
| 1493 |
class S {}; |
| 1494 |
|
| 1495 |
template <class T> |
| 1496 |
Array<T> Make(); |
| 1497 |
|
| 1498 |
void 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 conversion |
| 1506 |
// CHECK-ELIDE-TREE: Array< |
| 1507 |
// CHECK-ELIDE-TREE: [const != (no qualifiers)] S<...>> |
| 1508 |
// CHECK-NOELIDE-TREE: no viable conversion |
| 1509 |
// 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 |
|
| 1519 |
namespace pr30831 { |
| 1520 |
template <typename T> struct A { static A<T> const a; }; |
| 1521 |
template <typename T> A<T> A<T>::a = A<T>(); |
| 1522 |
} |