From 8fa7e270721d0a52a931ae744d7904a91e629792 Mon Sep 17 00:00:00 2001 From: Jonathan Emmett Date: Mon, 10 Aug 2020 17:16:18 -0400 Subject: [PATCH] Remove noexcept from coroutine_handle<>::resume and operator() With the adoption of [coroutine issue 25](http://open-std.org/JTC1/SC22/WG21/docs/papers/2018/p0664r6.html#25) it is no longer undefined behavior for an exception to escape the body of a coroutine, e.g. by rethrowing from `unhandled_exception`. Compiler support for handling such an exception was introduced to MSVC with version 16.7, and with this support it is now well-defined for `resume` to exit with an exception. This PR removes the strengthened noexcept specifiers from both `resume` and `operator()` which previously trapped the undefined behavior. --- stl/inc/coroutine | 4 ++-- stl/inc/experimental/coroutine | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/stl/inc/coroutine b/stl/inc/coroutine index fdf1a641e5e..2c939373da9 100644 --- a/stl/inc/coroutine +++ b/stl/inc/coroutine @@ -76,11 +76,11 @@ struct coroutine_handle { return __builtin_coro_done(_Ptr); } - void operator()() const noexcept { // strengthened + void operator()() const { __builtin_coro_resume(_Ptr); } - void resume() const noexcept { // strengthened + void resume() const { __builtin_coro_resume(_Ptr); } diff --git a/stl/inc/experimental/coroutine b/stl/inc/experimental/coroutine index a4068e07191..c6ed2a2a292 100644 --- a/stl/inc/experimental/coroutine +++ b/stl/inc/experimental/coroutine @@ -95,7 +95,7 @@ namespace experimental { return _Ptr; } - void operator()() const noexcept { + void operator()() const { resume(); }