[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


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


    [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