void foo(const int *n) { }
template <typename ...Args>
void bar(void (*func)(Args...), Args... args) { func(args...); }
int main(int argc, char *argv[])
{
int n = 42;
bar(foo, &n);
}
dm9pZCBmb28oY29uc3QgaW50ICpuKSB7IH0KCnRlbXBsYXRlIDx0eXBlbmFtZSAuLi5BcmdzPgp2b2lkIGJhcih2b2lkICgqZnVuYykoQXJncy4uLiksIEFyZ3MuLi4gYXJncykgeyBmdW5jKGFyZ3MuLi4pOyB9CgppbnQgbWFpbihpbnQgYXJnYywgY2hhciAqYXJndltdKQp7CiAgICBpbnQgbiA9IDQyOwogICAgYmFyKGZvbywgJm4pOwp9
prog.cpp: In function ‘int main(int, char**)’:
prog.cpp:9:16: error: no matching function for call to ‘bar(void (&)(const int*), int*)’
bar(foo, &n);
^
prog.cpp:4:6: note: candidate: template<class ... Args> void bar(void (*)(Args ...), Args ...)
void bar(void (*func)(Args...), Args... args) { func(args...); }
^~~
prog.cpp:4:6: note: template argument deduction/substitution failed:
prog.cpp:9:16: note: inconsistent parameter pack deduction with ‘const int*’ and ‘int*’
bar(foo, &n);
^