https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116880
--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Jason Merrill <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:4c743798b1d4530b327dad7c606c610f3811fdbf commit r15-7338-g4c743798b1d4530b327dad7c606c610f3811fdbf Author: Iain Sandoe <iains....@gmail.com> Date: Thu Oct 31 08:40:08 2024 +0000 c++/coroutines: Fix awaiter var creation [PR116506] Awaiters always need to have a coroutine state frame copy since they persist across potential supensions. It simplifies the later analysis considerably to assign these early which we do when building co_await expressions. The cleanups in r15-3146-g47dbd69b1, unfortunately elided some of processing used to cater for cases where the var created from an xvalue, or is a pointer/reference type. Corrected thus. PR c++/116506 PR c++/116880 gcc/cp/ChangeLog: * coroutines.cc (build_co_await): Ensure that xvalues are materialised. Handle references/pointer values in awaiter access expressions. (is_stable_lvalue): New. * decl.cc (cxx_maybe_build_cleanup): Handle null arg. gcc/testsuite/ChangeLog: * g++.dg/coroutines/pr116506.C: New test. * g++.dg/coroutines/pr116880.C: New test. Signed-off-by: Iain Sandoe <i...@sandoe.co.uk> Co-authored-by: Jason Merrill <ja...@redhat.com>