[ox] Fix for C++20

This commit is contained in:
2021-11-02 00:45:02 -05:00
parent e91d2653a3
commit f61efbafaf
6 changed files with 28 additions and 38 deletions

View File

@ -172,7 +172,7 @@ constexpr Error toError(const Result<T> &ve) noexcept {
constexpr void oxIgnoreError(const ox::Error&) noexcept {}
#if __cplusplus >= 202002L
#define oxReturnError(x) if (const auto _ox_error = ox::detail::toError(x)) [[unlikely]] return _ox_error
#define oxThrowError(x) if (const auto _ox_error = ox::detail::toError(x)) [[unlikely]] ox::Exception(_ox_error)
#define oxThrowError(x) if (const auto _ox_error = ox::detail::toError(x)) [[unlikely]] throw ox::Exception(_ox_error)
#else
#define oxReturnError(err) if (const auto _ox_error = ox::detail::toError(err)) return _ox_error
#define oxThrowError(err) if (const auto _ox_error = ox::detail::toError(err)) throw ox::Exception(_ox_error)