Move error inside and_then

Fixes #49
This commit is contained in:
Simon Brand
2019-02-25 11:51:54 +00:00
parent 2e007e9f57
commit edfdf3e689
2 changed files with 24 additions and 5 deletions
+20 -1
View File
@@ -105,4 +105,23 @@ TEST_CASE("Issue 42", "[issues.42]") {
TEST_CASE("Issue 43", "[issues.43]") {
auto result = tl::expected<void, std::string>{};
result = tl::make_unexpected(std::string{ "foo" });
}
}
#include <memory>
using MaybeDataPtr = tl::expected<int, std::unique_ptr<int>>;
MaybeDataPtr test(int i) noexcept
{
return std::move(i);
}
MaybeDataPtr test2(int i) noexcept
{
return std::move(i);
}
TEST_CASE("Issue 49", "[issues.49]") {
auto m = test(10)
.and_then(test2);
}