testsuite, coroutines : Mark final awaiters and co_await operators noexcept.

This is part of the requirement of [dcl.fct.def.coroutine]/15.

In addition to promise final_suspend() calls, the following cases must
also be noexcept as per discussion in PR95616.

- finalSuspendObj.operator co_await()
- finalSuspendAwaiter.await_ready()
- finalSuspendAwaiter.await_suspend()
- finalSuspendAwaiter.await_resume()
- finalSuspedObj destructor
- finalSuspendAwaiter destructor

Fixed for missing cases in the testsuite as a prerequisite to fixing
PR95616.

gcc/testsuite/ChangeLog:

	* g++.dg/coroutines/pr94879-folly-1.C: Make final suspend
	expression components noexcept.
	* g++.dg/coroutines/pr94883-folly-2.C: Likewise.
	* g++.dg/coroutines/pr95345.C: Likewise.
This commit is contained in:
Iain Sandoe 2021-02-28 01:13:50 +00:00
parent 7e5d7fc7e6
commit 3c173f7890
3 changed files with 10 additions and 10 deletions

View File

@ -18,14 +18,14 @@ class i {
namespace ac {
template <typename> class ad {
public:
bool await_ready();
void await_resume();
void await_suspend(std::coroutine_handle<>);
bool await_ready() noexcept;
void await_resume() noexcept;
void await_suspend(std::coroutine_handle<>) noexcept;
i ae;
};
} // namespace ac
template <typename ab> ac::ad<ab> operator co_await(ab);
template <typename ab> ac::ad<ab> operator co_await(ab) noexcept;
class j {
class l {};

View File

@ -16,9 +16,9 @@ int f;
class h {
class j {
public:
bool await_ready();
void await_suspend(std::coroutine_handle<>);
void await_resume();
bool await_ready() noexcept;
void await_suspend(std::coroutine_handle<>) noexcept;
void await_resume() noexcept;
};
public:

View File

@ -9,9 +9,9 @@ using namespace std::experimental;
struct dummy_coro
{
using promise_type = dummy_coro;
bool await_ready() { return false; }
void await_suspend(std::coroutine_handle<>) { }
void await_resume() { }
bool await_ready() noexcept { return false; }
void await_suspend(std::coroutine_handle<>) noexcept { }
void await_resume() noexcept { }
dummy_coro get_return_object() { return {}; }
dummy_coro initial_suspend() { return {}; }
dummy_coro final_suspend() noexcept { return {}; }