https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83542
Bug ID: 83542
Summary: template deduction failure when using pack in both
deduced and non-deduced contexts
Product: gcc
Version: 7.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
This example fails to compile:
template <typename... T>
struct list { };
template <typename... T, typename... U>
void foo(list<T...>, list<U...>, void(*)(T..., U...))
{ }
void f(int, int ) { }
int main()
{
foo(list<int>{}, list<int>{}, &f);
}
on gcc 7.2. with:
foo.cxx: In function ‘int main()’:
foo.cxx:13:37: error: no matching function for call to ‘foo(list<int>,
list<int>, void (*)(int, int))’
foo(list<int>{}, list<int>{}, &f);
^
foo.cxx:5:6: note: candidate: template<class ... T, class ... U> void
foo(list<T ...>, list<U ...>, void (*)(T ..., U ...))
void foo(list<T...>, list<U...>, void(*)(T..., U...))
^~~
foo.cxx:5:6: note: template argument deduction/substitution failed:
foo.cxx:13:37: note: inconsistent parameter pack deduction with ‘’ and ‘’
foo(list<int>{}, list<int>{}, &f);
^
But deduction should succeed - we can deduce T... and U... from the list<>
arguments. Additionally, the error message isn't very helpful. What do the ‘’s
refer to?