https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69623
Ed Catmur <ed at catmur dot uk> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ed at catmur dot uk
--- Comment #6 from Ed Catmur <ed at catmur dot uk> ---
There is a fairly well-known idiom for extracting a specific element of an
argument pack:
auto f(auto..., auto a, auto...) { return a; }
template<auto> struct any { any(auto) {} };
template<std::size_t... I>
auto g(std::index_sequence<I...>, auto... a) { return f<any<I>...>(a...); }
template<unsigned I>
auto h(auto... a) { return g(std::make_index_sequence<I>(), a...); }
I believe the intent of http://eel.is/c++draft/temp#param-14.sentence-3 is that
this idiom should work; per http://eel.is/c++draft/temp#param-example-7 (as in
comment #5) a function template secondary template parameter pack is only
disallowed if it is nondeducible. In the original description of this ticket
(not comment #5, which I agree is disallowed) T is specifiable and U is
deducible, so both are OK.
> [...] A template parameter pack of a function template shall not be followed
> by another template parameter unless that template parameter can be deduced
> from the parameter-type-list ([dcl.fct]) of the function template or has a
> default argument ([temp.deduct]). [...]
Or is the intent that T must be explicitly specified, i.e. that f can be called
as f<>() but not as f(), pace
http://eel.is/c++draft/temp#arg.explicit-4.sentence-3 ?
> If all of the template arguments can be deduced, they may all be omitted; in
> this case, the empty template argument list <> itself may also be omitted.