]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: coroutines and range for [PR118491]
authorJason Merrill <jason@redhat.com>
Fri, 31 Jan 2025 17:31:43 +0000 (12:31 -0500)
committerJason Merrill <jason@redhat.com>
Mon, 3 Feb 2025 21:55:03 +0000 (16:55 -0500)
commitec716ad3f4bdccb6a2780161e74e3168efa68121
tree7bd0fdac93d50f1324ffd925ea28b34b18e73730
parentf3a41e6cb5d70f0c94cc8273a118b8542fb5c2fa
c++: coroutines and range for [PR118491]

The implementation of extended range-for temporaries in r15-3840 confused
coroutines, because await_statement_walker and the like get confused by the
EXPR_STMT into thinking that the whole for-loop is a single expression
statement and try to process it accordingly.  Fixing this seems to be a
simple matter of dropping the EXPR_STMT.

PR c++/116914
PR c++/117231
PR c++/118470
PR c++/118491

gcc/cp/ChangeLog:

* semantics.cc (finish_for_stmt): Don't wrap the result of
pop_stmt_list in EXPR_STMT.

gcc/testsuite/ChangeLog:

* g++.dg/coroutines/coro-range-for1.C: New test.
gcc/cp/semantics.cc
gcc/testsuite/g++.dg/coroutines/coro-range-for1.C [new file with mode: 0644]