From 25c811e705a0111518fea189ce93cfc96bd7c36a Mon Sep 17 00:00:00 2001 From: Sylvain Garcia Date: Fri, 23 Oct 2020 07:40:58 +0200 Subject: [PATCH 1/2] fix unknown noop_coroutine type --- include/cppcoro/coroutine.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/cppcoro/coroutine.hpp b/include/cppcoro/coroutine.hpp index 2dedf561..2da1767d 100644 --- a/include/cppcoro/coroutine.hpp +++ b/include/cppcoro/coroutine.hpp @@ -20,7 +20,10 @@ namespace cppcoro { using std::experimental::coroutine_handle; using std::experimental::suspend_always; using std::experimental::suspend_never; - using std::experimental::noop_coroutine; + +#if CPPCORO_COMPILER_SUPPORTS_SYMMETRIC_TRANSFER + using std::experimental::noop_coroutine; +#endif } #else From 3d6cd95d8929147d6d91dd758abee7a180e5fbbe Mon Sep 17 00:00:00 2001 From: Sylvain Garcia Date: Mon, 19 Oct 2020 20:34:56 +0200 Subject: [PATCH 2/2] no MSVC 2017 workarounds on MSVC 2019 --- include/cppcoro/detail/sync_wait_task.hpp | 4 ++-- include/cppcoro/detail/when_all_task.hpp | 6 +++--- include/cppcoro/sync_wait.hpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/cppcoro/detail/sync_wait_task.hpp b/include/cppcoro/detail/sync_wait_task.hpp index 2834a273..39b906bf 100644 --- a/include/cppcoro/detail/sync_wait_task.hpp +++ b/include/cppcoro/detail/sync_wait_task.hpp @@ -68,7 +68,7 @@ namespace cppcoro return completion_notifier{}; } -#if CPPCORO_COMPILER_MSVC +#if CPPCORO_COMPILER_MSVC && CPPCORO_COMPILER_MSVC < 19'00'00000 // HACK: This is needed to work around a bug in MSVC 2017.7/2017.8. // See comment in make_sync_wait_task below. template @@ -245,7 +245,7 @@ namespace cppcoro }; -#if CPPCORO_COMPILER_MSVC +#if CPPCORO_COMPILER_MSVC && CPPCORO_COMPILER_MSVC < 19'00'00000 // HACK: Work around bug in MSVC where passing a parameter by universal reference // results in an error when passed a move-only type, complaining that the copy-constructor // has been deleted. The parameter should be passed by reference and the compiler should diff --git a/include/cppcoro/detail/when_all_task.hpp b/include/cppcoro/detail/when_all_task.hpp index a9a6f454..d14789e8 100644 --- a/include/cppcoro/detail/when_all_task.hpp +++ b/include/cppcoro/detail/when_all_task.hpp @@ -76,7 +76,7 @@ namespace cppcoro assert(false); } -#if CPPCORO_COMPILER_MSVC +#if CPPCORO_COMPILER_MSVC && CPPCORO_COMPILER_MSVC < 19'00'00000 // HACK: This is needed to work around a bug in MSVC 2017.7/2017.8. // See comment in make_when_all_task below. template @@ -301,7 +301,7 @@ namespace cppcoro std::enable_if_t, int> = 0> when_all_task make_when_all_task(AWAITABLE awaitable) { -#if CPPCORO_COMPILER_MSVC +#if CPPCORO_COMPILER_MSVC && CPPCORO_COMPILER_MSVC < 19'00'00000 // HACK: Workaround another bug in MSVC where the expression 'co_yield co_await x' seems // to completely ignore the co_yield an never calls promise.yield_value(). // The coroutine seems to be resuming the 'co_await' after the 'co_yield' @@ -329,7 +329,7 @@ namespace cppcoro std::enable_if_t, int> = 0> when_all_task make_when_all_task(std::reference_wrapper awaitable) { -#if CPPCORO_COMPILER_MSVC +#if CPPCORO_COMPILER_MSVC && CPPCORO_COMPILER_MSVC < 19'00'00000 // HACK: Workaround another bug in MSVC where the expression 'co_yield co_await x' seems // to completely ignore the co_yield and never calls promise.yield_value(). // The coroutine seems to be resuming the 'co_await' after the 'co_yield' diff --git a/include/cppcoro/sync_wait.hpp b/include/cppcoro/sync_wait.hpp index 99fb20bd..e64dd27b 100644 --- a/include/cppcoro/sync_wait.hpp +++ b/include/cppcoro/sync_wait.hpp @@ -18,7 +18,7 @@ namespace cppcoro auto sync_wait(AWAITABLE&& awaitable) -> typename cppcoro::awaitable_traits::await_result_t { -#if CPPCORO_COMPILER_MSVC +#if CPPCORO_COMPILER_MSVC && CPPCORO_COMPILER_MSVC < 19'00'00000 // HACK: Need to explicitly specify template argument to make_sync_wait_task // here to work around a bug in MSVC when passing parameters by universal // reference to a coroutine which causes the compiler to think it needs to