]> git.ipfire.org Git - thirdparty/gcc.git/commit
coroutines: Improve diagnostics for one allocator case.
authorIain Sandoe <iain@sandoe.co.uk>
Sat, 27 Jun 2020 07:54:39 +0000 (08:54 +0100)
committerGiuliano Belinassi <giuliano.belinassi@usp.br>
Mon, 17 Aug 2020 16:15:08 +0000 (13:15 -0300)
commit1861354754940214d12b04de0685c6ebd35cf28f
tree563eea6c369602c9ea9f86197f0cb27d4ddfbd85
parent10cb3ecbba198cc75108f916b22259b2a4545503
coroutines: Improve diagnostics for one allocator case.

If the user provides operator new and that is noexcept, this
implies that it can fail with a null return.  At that point, we expect
to be able to call get_return_object_on_allocation_failure().

This diagnoses the case where such an operator new has been
provided, but the g-r-o-o-a-f is either missing or unusable.

gcc/cp/ChangeLog:

* coroutines.cc (morph_fn_to_coro): Diagnose unavailable
get_return_object_on_allocation_failure.

gcc/testsuite/ChangeLog:

* g++.dg/coroutines/coro-bad-grooaf-01-grooaf-expected.C: New test.
gcc/cp/coroutines.cc
gcc/testsuite/g++.dg/coroutines/coro-bad-grooaf-01-grooaf-expected.C [new file with mode: 0644]