I'm trying to define a recursive lambda.
In other languages, such as go, it could be declared as:
func main() {
var f func()
f = func() { f() }
}
Maybe it's caused by implementation with template?
#include <functional>
int main() {
std::function<int()> f;
int a = 0;
f = [f,&a]() -> int {
a++;
if (a > 2) {
return 1;
}
return f();
};
if (f() != 0) {
goto out;
}
out:
return 0;
}
Here's my compiler:
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
fby value? Before it's initialized?goto. Especially if it's totally useless (like in the code shown).