Add test for issue 23

This commit is contained in:
Simon Brand
2018-08-22 15:09:59 +01:00
parent 89813870eb
commit 53527b804b
2 changed files with 9 additions and 1 deletions

View File

@@ -143,7 +143,6 @@ matrix:
packages:
- g++-5
env: COMPILER=g++-5 CXXSTD=14
- compiler: gcc
addons:
apt:

View File

@@ -26,6 +26,15 @@ TEST_CASE("Issue 17", "[issues.17]") {
struct a {};
struct b : a {};
auto doit() -> tl::expected<std::unique_ptr<b>, int> {
return tl::make_unexpected(0);
}
TEST_CASE("Issue 23", "[issues.23]") {
tl::expected<std::unique_ptr<a>, int> msg = doit();
REQUIRE(!msg.has_value());
}
TEST_CASE("Issue 26", "[issues.26]") {
tl::expected<a, int> exp = tl::expected<b, int>(tl::unexpect, 0);
REQUIRE(!exp.has_value());