// Example program
#include <iostream>
#include <string>
void Do()
{
std::cout << "Hello";
}
int Call(int(*f)())
{
return f();
}
int main()
{
// WHY DOES THE FOLLOWING COMPILE???!!!
// NOTE THE MISSING RETURN STATEMENT
Call([]()->int{ Do(); });
}
It seems for some compiler, the code above compiles fine, and it also works. But apparently, the lambda is missing the return statement. Why does this work? Is it a problem with the compiler? What does the lambda return in this case?