#include <functional>
void foo(std::function<void()> f) { f(); }
void foo(void (*f)()) { f(); }
int main ()
{
foo( [](){} );
}
VS compiles, gcc and clang complain about ambiguous overload. Who's right? The lambda is supposed to be of a class type, so there should not be any conversion between it and a function pointer. Thus VS appears to be right, against all odds. But perhaps I'm missing something.
Is there a simple way to disambiguate the call, apart from casting the lambda to either type?