Why is the 2nd assignment allowed, when the inferred return type is std::nullptr_t? With function pointers this is forbidden.
And why doesn't the 2nd lambda run?
#include <cstdio>
#include <functional>
int main()
{
std::function<void* ()> f;
f = []() -> void* {
printf ("runs\n");
return nullptr;
};
f();
f = []() {
printf ("doesn't run\n");
return nullptr; // -> std::nullptr_t
};
f();
return 0;
}