diff --git a/include/unifex/await_transform.hpp b/include/unifex/await_transform.hpp index d0a444026..c71e55678 100644 --- a/include/unifex/await_transform.hpp +++ b/include/unifex/await_transform.hpp @@ -115,7 +115,7 @@ struct _awaitable_base::type { } template (class Error) - (requires exception_ptr_convertible) + (requires is_exception_ptr_convertible_v) void set_error(Error &&error) && noexcept { unifex::activate_union_member(result_->exception_, get_exception_ptr(std::forward(error))); result_->state_ = _state::exception; diff --git a/include/unifex/get_exception_ptr.hpp b/include/unifex/get_exception_ptr.hpp index 9057970f1..3cfe20374 100644 --- a/include/unifex/get_exception_ptr.hpp +++ b/include/unifex/get_exception_ptr.hpp @@ -16,10 +16,9 @@ #pragma once #include +#include -#include #include -#include #include @@ -33,11 +32,9 @@ namespace unifex } } get_exception_ptr{}; - template - concept exception_ptr_convertible = requires(Error error) { - { get_exception_ptr(std::move(error)) } -> std::same_as; - }; - + template + constexpr bool is_exception_ptr_convertible_v = + is_callable_v<_get_exception_ptr_cpo, remove_cvref_t>; } // namespace unifex #include diff --git a/test/get_exception_ptr_test.cpp b/test/get_exception_ptr_test.cpp index 7c30f8694..82eb55bf9 100644 --- a/test/get_exception_ptr_test.cpp +++ b/test/get_exception_ptr_test.cpp @@ -28,7 +28,7 @@ namespace unifex } } // namespace unifex -static_assert(exception_ptr_convertible); +static_assert(is_exception_ptr_convertible_v); TEST(get_exception_ptr, error_code) { try { @@ -49,7 +49,7 @@ std::exception_ptr tag_invoke(tag_t, test_error&& error) { std::runtime_error(std::to_string(error.error_code))); } -static_assert(exception_ptr_convertible); +static_assert(is_exception_ptr_convertible_v); TEST(get_exception_ptr, custom_error) { try {