Why function default parameters cannot be perferct forwarded in C++?

Viewed 428

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://rextester.com/live/JOCY22484

1 Answers
Related