[Bug c++/83542] template deduction failure when using pack in both deduced and non-deduced contexts
barry.revzin at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Dec 21 23:22:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83542
--- Comment #1 from Barry Revzin <barry.revzin at gmail dot com> ---
This slightly different example:
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);
}
fails with a different error:
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: candidate expects 1 argument, 2 provided
foo(list<int>{}, list<int>{}, &f);
^
More information about the Gcc-bugs
mailing list