]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++, coroutines: Only allow void get_return_object if the ramp is void [PR100476].
authorIain Sandoe <iain@sandoe.co.uk>
Sat, 17 Aug 2024 14:47:58 +0000 (15:47 +0100)
committerIain Sandoe <iain@sandoe.co.uk>
Sat, 24 Aug 2024 18:53:51 +0000 (19:53 +0100)
commita0b431033c307982123abbff752045cfe7eda47f
tree3b7dd5ee47d823152a0a6849aabf2cb395dc59db
parentefc99ab2d5fdb7f2a942199b0e5b16e1e2bb8c27
c++, coroutines: Only allow void get_return_object if the ramp is void [PR100476].

Require that the value returned by get_return_object is convertible to
the ramp return.  This means that the only time we allow a void
get_return_object, is when the ramp is also a void function.

We diagnose this early to allow us to exit the ramp build if the return
values are incompatible.

PR c++/100476

gcc/cp/ChangeLog:

* coroutines.cc
(cp_coroutine_transform::build_ramp_function): Remove special
handling of void get_return_object expressions.

gcc/testsuite/ChangeLog:

* g++.dg/coroutines/coro-bad-gro-01-void-gro-non-class-coro.C:
Adjust expected diagnostic.
* g++.dg/coroutines/pr102489.C: Avoid void get_return_object.
* g++.dg/coroutines/pr103868.C: Likewise.
* g++.dg/coroutines/pr94879-folly-1.C: Likewise.
* g++.dg/coroutines/pr94883-folly-2.C: Likewise.
* g++.dg/coroutines/pr96749-2.C: Likewise.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
gcc/cp/coroutines.cc
gcc/testsuite/g++.dg/coroutines/coro-bad-gro-01-void-gro-non-class-coro.C
gcc/testsuite/g++.dg/coroutines/pr102489.C
gcc/testsuite/g++.dg/coroutines/pr103868.C
gcc/testsuite/g++.dg/coroutines/pr94879-folly-1.C
gcc/testsuite/g++.dg/coroutines/pr94883-folly-2.C
gcc/testsuite/g++.dg/coroutines/pr96749-2.C