Skip to content

Commit

Permalink
fix c++17 compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
Garcia6l20 committed Apr 4, 2021
1 parent 8aa50c8 commit 2beb643
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion include/unifex/await_transform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ struct _awaitable_base<Promise, Value>::type {
}

template (class Error)
(requires exception_ptr_convertible<Error>)
(requires is_exception_ptr_convertible_v<Error>)
void set_error(Error &&error) && noexcept {
unifex::activate_union_member(result_->exception_, get_exception_ptr(std::forward<Error>(error)));
result_->state_ = _state::exception;
Expand Down
11 changes: 4 additions & 7 deletions include/unifex/get_exception_ptr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
#pragma once

#include <unifex/tag_invoke.hpp>
#include <unifex/type_traits.hpp>

#include <concepts>
#include <memory>
#include <system_error>

#include <unifex/detail/prologue.hpp>

Expand All @@ -33,11 +32,9 @@ namespace unifex
}
} get_exception_ptr{};

template <typename Error>
concept exception_ptr_convertible = requires(Error error) {
{ get_exception_ptr(std::move(error)) } -> std::same_as<std::exception_ptr>;
};

template <typename T>
constexpr bool is_exception_ptr_convertible_v =
is_callable_v<_get_exception_ptr_cpo, remove_cvref_t<T>>;
} // namespace unifex

#include <unifex/detail/epilogue.hpp>
4 changes: 2 additions & 2 deletions test/get_exception_ptr_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace unifex
}
} // namespace unifex

static_assert(exception_ptr_convertible<std::error_code>);
static_assert(is_exception_ptr_convertible_v<std::error_code>);

TEST(get_exception_ptr, error_code) {
try {
Expand All @@ -49,7 +49,7 @@ std::exception_ptr tag_invoke(tag_t<get_exception_ptr>, test_error&& error) {
std::runtime_error(std::to_string(error.error_code)));
}

static_assert(exception_ptr_convertible<test_error>);
static_assert(is_exception_ptr_convertible_v<test_error>);

TEST(get_exception_ptr, custom_error) {
try {
Expand Down

0 comments on commit 2beb643

Please sign in to comment.