Skip to content

Commit d30447f

Browse files
committed
Add tests
1 parent b57b862 commit d30447f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

clang/test/SemaTemplate/deduction.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ struct X0<int, A> {
1313
static const unsigned value = 1;
1414
};
1515

16+
template<class T>
17+
struct type_identity {
18+
using type = T;
19+
};
20+
21+
template<class T>
22+
using type_identity_t = typename type_identity<T>::type;
23+
24+
template <typename... T>
25+
struct args_tag {};
26+
1627
template<int> struct X0i;
1728
template<long> struct X0l;
1829
int array_x0a[X0<long, X0l>::value == 0? 1 : -1];
@@ -431,6 +442,17 @@ namespace deduction_after_explicit_pack {
431442
i<int, int>(0, 1, 2, 3, 4, 5); // expected-error {{no match}}
432443
}
433444

445+
template <typename... T>
446+
void bar(args_tag<T...>, type_identity_t<T>..., int mid, type_identity_t<T>...) {}
447+
void call_bar() {
448+
bar(args_tag<int, int>{}, 4, 8, 1001, 16, 23);
449+
}
450+
template <typename... Y, typename... T>
451+
void foo(args_tag<Y...>, args_tag<T...>, type_identity_t<T>..., int mid, type_identity_t<T>...) {}
452+
void call_foo() {
453+
foo(args_tag<const int,const int, const int>{}, args_tag<int, int, int>{}, 4, 8, 9, 15, 16, 23, 1);
454+
}
455+
434456
// GCC alarmingly accepts this by deducing T={int} by matching the second
435457
// parameter against the first argument, then passing the first argument
436458
// through the first parameter.

0 commit comments

Comments
 (0)