Skip to content

Commit

Permalink
coro: fix noexcept declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
xlauko committed Feb 27, 2024
1 parent 351fb3b commit 31486f9
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions coro/include/gap/coro/fmap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,22 @@ namespace gap::coro
decltype(auto) await_ready()
noexcept(noexcept(static_cast< awaiter_t&& >(m_awaiter).await_ready()))
{
return static_cast<awaiter_t&&>(m_awaiter).await_ready();
return static_cast< awaiter_t&& >(m_awaiter).await_ready();
}

template< typename promise_t >
decltype(auto) await_suspend(gap::coroutine_handle< promise_t > coroutine)
noexcept(noexcept(static_cast< awaiter_t&& >(m_awaiter).await_suspend(std::move(coroutine))))
noexcept(noexcept(
static_cast< awaiter_t&& >(std::declval< awaiter_t >()).await_suspend(std::move(coroutine))
))
{
return static_cast<awaiter_t&&>(m_awaiter).await_suspend(std::move(coroutine));
return static_cast< awaiter_t&& >(m_awaiter).await_suspend(std::move(coroutine));
}

template< typename await_result = decltype(std::declval< awaiter_t >().await_resume()) >
requires std::is_void_v< await_result >
decltype(auto) await_resume()
noexcept(noexcept(std::invoke(static_cast< func_t&& >(m_func))))
noexcept(noexcept(std::invoke(static_cast< func_t&& >(std::declval< func_t >()))))
{
static_cast<awaiter_t&&>(m_awaiter).await_resume();
return std::invoke(static_cast< func_t&& >(m_func));
Expand All @@ -54,11 +56,15 @@ namespace gap::coro
template< typename await_result = decltype(std::declval< awaiter_t >().await_resume()) >
requires (not std::is_void_v< await_result >)
decltype(auto) await_resume()
noexcept(noexcept(std::invoke(static_cast< func_t&& >(m_func), static_cast<awaiter_t&&>(m_awaiter).await_resume())))
noexcept(noexcept(
std::invoke(
static_cast< func_t&& >(std::declval< func_t >()),
static_cast< awaiter_t&& >(std::declval< awaiter_t >()).await_resume())
))
{
return std::invoke(
static_cast< func_t&& >(m_func),
static_cast<awaiter_t&&>(m_awaiter).await_resume()
static_cast< awaiter_t&& >(m_awaiter).await_resume()
);
}
private:
Expand Down

0 comments on commit 31486f9

Please sign in to comment.