Fixed issue #129 (#131)

+ Fixed unused variable warning
+ Added a `std::move` to avoid calling copy-assignment operator on non-copyable types

Co-authored-by: andy-byers <andrew.byers@utdallas.edu>
This commit is contained in:
Andrew Byers
2023-02-15 15:54:16 +00:00
committed by GitHub
co-authored by andy-byers
parent 79a2068c9a
commit f5e6e9aeed
3 changed files with 16 additions and 1 deletions
+8
View File
@@ -183,4 +183,12 @@ TEST_CASE("Issue 107", "[issues.107]") {
REQUIRE(ex1.error().j == 0);
REQUIRE(ex2.error().i == 2);
REQUIRE(ex2.error().j == 2);
}
TEST_CASE("Issue 129", "[issues.129]") {
tl::expected<std::unique_ptr<int>, int> x1 {std::make_unique<int>(4)};
tl::expected<std::unique_ptr<int>, int> y1 {std::make_unique<int>(2)};
x1 = std::move(y1);
REQUIRE(**x1 == 2);
}