]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++, coroutines: Allow convertible get_return_on_allocation_fail [PR109682].
authorIain Sandoe <iain@sandoe.co.uk>
Sat, 17 Aug 2024 15:55:29 +0000 (16:55 +0100)
committerIain Sandoe <iain@sandoe.co.uk>
Mon, 5 May 2025 19:31:04 +0000 (20:31 +0100)
commit1b3addb6fe05a80d5e043fbb12cc9c0cc426b0e6
tree02bf73f7bb06de1f1b06de7ab8c035d723d5e03b
parent98364636c194398d5dccb477e5405cb1d02a55f1
c++, coroutines: Allow convertible get_return_on_allocation_fail [PR109682].

We have been requiring the get_return_on_allocation_fail() call to have the
same type as the ramp.  This is not intended by the standard, so relax that
to allow anything convertible to the ramp return.

PR c++/109682

gcc/cp/ChangeLog:

* coroutines.cc
(cp_coroutine_transform::build_ramp_function): Allow for cases where
get_return_on_allocation_fail has a type convertible to the ramp
return type.

gcc/testsuite/ChangeLog:

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

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