]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++, coroutines: Handle unevaluated contexts.
authorIain Sandoe <iain@sandoe.co.uk>
Sun, 8 Jun 2025 13:28:01 +0000 (14:28 +0100)
committerIain Sandoe <iain@sandoe.co.uk>
Tue, 29 Jul 2025 15:08:51 +0000 (16:08 +0100)
commitf4ae768a923359f67ec91cd3159de2ae39fa14d6
tree1515aac91ad1cd2522478eac1dafc292fb1ff4fb
parent38db03d978017b3c4eefb1b1239793e50a84b25a
c++, coroutines: Handle unevaluated contexts.

From [expr.await]/2
We should not accept co_await, co_yield in unevaluated contexts.

Currently (see PR68604) we do not mark typeid expressions as unevaluated
since the standard rules mean that this depends on the value type.

gcc/cp/ChangeLog:

* coroutines.cc (finish_co_await_expr): Do not allow in an
unevaluated context.
(finish_co_yield_expr): Likewise.

gcc/testsuite/ChangeLog:

* g++.dg/coroutines/unevaluated.C: New test.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
(cherry picked from commit e2bff264e8b92426b13aacec3087cb97971ec9b9)
gcc/cp/coroutines.cc
gcc/testsuite/g++.dg/coroutines/unevaluated.C [new file with mode: 0644]