Consider this template function:
template
ReturnT foo(const std::function& fun)
{
return fun();
}
>
std::function bar;
foo(bar); // works just fine
C++ can't deduce the return type from your function bar because it would have to know the type before it could find all the constructors that take your function pointer.
For example, who's to say that std::function doesn't have a constructor taking a bool (*)()?