by somerando7 · 4y ago · 0 comments
It's a nasty bug that everyone encounters when first working with coroutines. (Similarly everyone will encounter references that don't live until you co_await the task).
task<Foo> t = [foo]() {
return [](auto f) -> task<Foo> {
co_await something();
co_return f;
}(foo);
}();