diff --git a/tests/issues.cpp b/tests/issues.cpp index 1cd8550..8636373 100644 --- a/tests/issues.cpp +++ b/tests/issues.cpp @@ -91,3 +91,13 @@ TEST_CASE("Issue 34", "[issues.34]") { .and_then (work2); result.map_error ([&] (std::string result) {errorhandling (result);}); } + +struct non_copyable { + non_copyable(non_copyable&&) = default; + non_copyable(non_copyable const&) = delete; + non_copyable() = default; +}; + +TEST_CASE("Issue 42", "[issues.42]") { + tl::expected{}.map([](non_copyable) {}); +} \ No newline at end of file diff --git a/tl/expected.hpp b/tl/expected.hpp index 659d5d1..8e8bc6e 100644 --- a/tl/expected.hpp +++ b/tl/expected.hpp @@ -1301,7 +1301,7 @@ public: /// \synopsis template constexpr auto map(F &&f) &&; template TL_EXPECTED_11_CONSTEXPR decltype( - expected_map_impl(std::declval(), std::declval())) + expected_map_impl(std::declval(), std::declval())) map(F &&f) && { return expected_map_impl(std::move(*this), std::forward(f)); }