https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100850
--- Comment #3 from Vlad <vsolontsov at volanttrading dot com> --- My bad. It's actually a UB. The lambda lifetime is just over by the moment of resumption of the co-routine.
vsolontsov at volanttrading dot com via Gcc-bugs Tue, 01 Jun 2021 09:21:12 -0700
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100850
--- Comment #3 from Vlad <vsolontsov at volanttrading dot com> --- My bad. It's actually a UB. The lambda lifetime is just over by the moment of resumption of the co-routine.