diff --git a/include/tl/expected.hpp b/include/tl/expected.hpp index 97591d0..31a5193 100644 --- a/include/tl/expected.hpp +++ b/include/tl/expected.hpp @@ -18,7 +18,7 @@ #define TL_EXPECTED_VERSION_MAJOR 1 #define TL_EXPECTED_VERSION_MINOR 0 -#define TL_EXPECTED_VERSION_PATCH 0 +#define TL_EXPECTED_VERSION_PATCH 1 #include #include @@ -1907,14 +1907,14 @@ public: detail::enable_if_t::value> * = nullptr> TL_EXPECTED_11_CONSTEXPR const U &&value() const && { if (!has_value()) - detail::throw_exception(bad_expected_access(err().value())); + detail::throw_exception(bad_expected_access(std::move(err()).value())); return std::move(val()); } template ::value> * = nullptr> TL_EXPECTED_11_CONSTEXPR U &&value() && { if (!has_value()) - detail::throw_exception(bad_expected_access(err().value())); + detail::throw_exception(bad_expected_access(std::move(err()).value())); return std::move(val()); } diff --git a/tests/issues.cpp b/tests/issues.cpp index c2847ea..2cd16be 100644 --- a/tests/issues.cpp +++ b/tests/issues.cpp @@ -126,4 +126,13 @@ TEST_CASE("Issue 49", "[issues.49]") { auto m = test(10) .and_then(test2); } -#endif \ No newline at end of file +#endif + +tl::expected> func() +{ + return 1; +} + +TEST_CASE("Issue 61", "[issues.61]") { + REQUIRE(func().value() == 1); +} \ No newline at end of file