diff --git a/tests/issues.cpp b/tests/issues.cpp index 5447b35..c3efa44 100644 --- a/tests/issues.cpp +++ b/tests/issues.cpp @@ -68,4 +68,8 @@ struct i31{ TEST_CASE("Issue 31", "[issues.31]") { const tl::expected a = i31{42}; a->i; + + tl::expected< void, std::string > result; + tl::expected< void, std::string > result2 = result; + result2 = result; } diff --git a/tl/expected.hpp b/tl/expected.hpp index 71a59d9..60c1f54 100644 --- a/tl/expected.hpp +++ b/tl/expected.hpp @@ -324,6 +324,16 @@ template using is_move_constructible_or_void = is_void_or>; +template +using is_copy_assignable_or_void = + is_void_or>; + + +template +using is_move_assignable_or_void = + is_void_or>; + + } // namespace detail /// \exclude @@ -998,13 +1008,13 @@ struct expected_delete_ctor_base { // constructors depending on whether T and E are copy/move constructible + // assignable template ::value && + bool EnableCopy = (is_copy_constructible_or_void::value && std::is_copy_constructible::value && - std::is_copy_assignable::value && + is_copy_assignable_or_void::value && std::is_copy_assignable::value), - bool EnableMove = (std::is_move_constructible::value && + bool EnableMove = (is_move_constructible_or_void::value && std::is_move_constructible::value && - std::is_move_assignable::value && + is_move_assignable_or_void::value && std::is_move_assignable::value)> struct expected_delete_assign_base { expected_delete_assign_base() = default;