-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[Sema] Substitute parameter packs when deduced from function arguments #79371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 13 commits
3e0c3db
59a01f3
c7aaaad
d3cdcc3
155e133
e486162
018deaa
486fffe
33336a7
47f86af
8705e03
01dab7d
fdf3a00
4c36190
74ec3b3
400cdec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,17 @@ struct X0<int, A> { | |
static const unsigned value = 1; | ||
}; | ||
|
||
template<class T> | ||
struct type_identity { | ||
using type = T; | ||
}; | ||
|
||
template<class T> | ||
using type_identity_t = typename type_identity<T>::type; | ||
|
||
template <typename... T> | ||
struct args_tag {}; | ||
|
||
template<int> struct X0i; | ||
template<long> struct X0l; | ||
int array_x0a[X0<long, X0l>::value == 0? 1 : -1]; | ||
|
@@ -431,6 +442,23 @@ namespace deduction_after_explicit_pack { | |
i<int, int>(0, 1, 2, 3, 4, 5); // expected-error {{no match}} | ||
} | ||
|
||
template <typename... T> | ||
void bar(args_tag<T...>, type_identity_t<T>..., int mid, type_identity_t<T>...) {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens without the mid parameter ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It could work. It would cost only condition being removed. I deliberately put in the condition that disables this. Should I enable it? I think enabling it would be standard compliant, but I played it safe and stuck to the example seen in the issue. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, i think we should support that, and add a test for it )as long as the standard says it should work, which i think it does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added a test for this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd like to see a test for template <typename... Y, typename... T>
void foo2(args_tag<Y...>, args_tag<T...>, type_identity_t<T>..., type_identity_t<T>...) {} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added the test. It also works. |
||
void call_bar() { | ||
bar(args_tag<int, int>{}, 4, 8, 1001, 16, 23); | ||
} | ||
|
||
template <typename... Y, typename... T> | ||
void foo(args_tag<Y...>, args_tag<T...>, type_identity_t<T>..., int mid, type_identity_t<T>...) {} | ||
void call_foo() { | ||
foo(args_tag<const int,const int, const int>{}, args_tag<int, int, int>{}, 4, 8, 9, 15, 16, 23, 1); | ||
} | ||
|
||
template <typename... Y, typename... T> void baz(args_tag<T...>, T..., T...) {} | ||
void call_baz() { | ||
baz(args_tag<int, int>{}, 1, 2, 3, 4); | ||
} | ||
|
||
// GCC alarmingly accepts this by deducing T={int} by matching the second | ||
// parameter against the first argument, then passing the first argument | ||
// through the first parameter. | ||
|
Uh oh!
There was an error while loading. Please reload this page.