[Bug c++/95111] coroutines use-after-free with lambdas

avi@cloudius-systems.com gcc-bugzilla@gcc.gnu.org
Wed May 13 20:24:28 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95111

--- Comment #10 from Avi Kivity <avi@cloudius-systems.com> ---
Well, the standard is useless here.

In

    [foo] () -> lazy<foo> { co_return foo; } ()

a temporary is clearly passed to the lambda body, yet the standard mandates
that we capture it by reference. As a result, a use-after-free is guaranteed.


More information about the Gcc-bugs mailing list