I found quite weird behavior from my perspective: function default arguments cannot be forwarded in code bellow.
void Test(int test = int{}) {}
template<typename F, typename ...Args>
void Foo(F&& f, Args&&... args)
{
std::forward<F>(f)(std::forward<Args>(args)...);
}
int main()
{
Foo(Test, 0); // This compiles
Foo(Test); // This doesn't compile
}
Clang reports: error: too few arguments to function call, expected 1, have 0 GCC and VC report same errors.
Can anybody explain it?
Code is here: http://ift.tt/2tNWoFS
Aucun commentaire:
Enregistrer un commentaire