Here is a minimal example that causes a compilation error:
#include <utility> void foo(int, double, int) {} template <class... Args> void post_forwarder(void(*fun)(Args..., int), Args&&... aArgs) { fun(std::forward<Args>(aArgs)..., 5); } int main() { post_forwarder(foo, 6, 6.1); // Compilation error on instantiation return 0; }
I suspect that the problem is that the parameter of the variational template is expanded in the function type to a fixed parameter int, but if so, I can not find a good justification for it.
Error reported by Clang 3.6:
error: no matching function for call to 'post_forwarder' note: candidate template ignored: failed template argument deduction
source share