From 46bb0331cbb98b175a346986e22c28d99a93381b Mon Sep 17 00:00:00 2001 From: Jan Christoph Uhde Date: Fri, 24 Jan 2020 15:55:13 +0100 Subject: [PATCH] expected_changes --- include/ext/util/expected.hpp | 12 ++++++------ tests/expected/issues.cpp | 12 ++++++------ tests/expected/swap.cpp | 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/ext/util/expected.hpp b/include/ext/util/expected.hpp index 12679f33..8a9e0599 100644 --- a/include/ext/util/expected.hpp +++ b/include/ext/util/expected.hpp @@ -175,7 +175,7 @@ struct is_expected_impl> : std::true_type {}; template using is_expected = is_expected_impl>; template -constexpr bool is_expected_v = is_expected::value; +inline constexpr bool is_expected_v = is_expected::value; template using expected_enable_forward_value = @@ -203,19 +203,19 @@ template using is_void_or = std::conditional_t, std::true_type, U>; template -constexpr bool is_void_or_v = std::conditional_t, std::true_type, BoolConstant>::value; +inline constexpr bool is_void_or_v = std::conditional_t, std::true_type, BoolConstant>::value; template -constexpr bool is_copy_constructible_or_void_v = is_void_or_v>; +inline constexpr bool is_copy_constructible_or_void_v = is_void_or_v>; template -constexpr bool is_move_constructible_or_void_v = is_void_or_v>; +inline constexpr bool is_move_constructible_or_void_v = is_void_or_v>; template -constexpr bool is_copy_assignable_or_void_v = is_void_or_v>; +inline constexpr bool is_copy_assignable_or_void_v = is_void_or_v>; template -constexpr bool is_move_assignable_or_void_v = is_void_or_v>; +inline constexpr bool is_move_assignable_or_void_v = is_void_or_v>; } // namespace detail diff --git a/tests/expected/issues.cpp b/tests/expected/issues.cpp index abdcce6e..99aaa638 100644 --- a/tests/expected/issues.cpp +++ b/tests/expected/issues.cpp @@ -24,7 +24,7 @@ eu::expected operation1() { return 42; } -eu::expected operation2(int const val) { +eu::expected operation2(int const) { return "Bananas"; } @@ -80,7 +80,7 @@ struct i31 { }; TEST(expected_extensions, issue31) { const eu::expected a = i31{42}; - a->i; + (void) a->i; eu::expected result; eu::expected result2 = result; @@ -90,7 +90,7 @@ TEST(expected_extensions, issue31) { TEST(expected_extensions, issue33) { eu::expected res{eu::unexpect, 0}; EXPECT_TRUE(!res); - res = res.map_error([](int) { + res = res.map_error([](int) noexcept { return 42; }); EXPECT_TRUE(res.error() == 42); @@ -107,8 +107,8 @@ void errorhandling(std::string) {} TEST(expected_extensions, issue34) { eu::expected result = voidWork().and_then(work2); - result.map_error([&](std::string result) { - errorhandling(result); + result.map_error([&](std::string res) { + errorhandling(res); }); } @@ -119,7 +119,7 @@ struct non_copyable { }; TEST(expected_extensions, issue42) { - eu::expected{}.map([](non_copyable) { + eu::expected{}.map([](non_copyable) noexcept { }); } diff --git a/tests/expected/swap.cpp b/tests/expected/swap.cpp index afb2c57e..8ea18e0f 100644 --- a/tests/expected/swap.cpp +++ b/tests/expected/swap.cpp @@ -2,12 +2,12 @@ #include struct no_throw { - no_throw(std::string i) : i(i) {} + no_throw(std::string s) : i(s) {} std::string i; }; struct canthrow_move { - canthrow_move(std::string i) : i(i) {} + canthrow_move(std::string s) : i(s) {} canthrow_move(canthrow_move const&) = default; canthrow_move(canthrow_move&& other) noexcept(false) : i(other.i) {} canthrow_move& operator=(canthrow_move&&) = default; @@ -16,7 +16,7 @@ struct canthrow_move { bool should_throw = false; struct willthrow_move { - willthrow_move(std::string i) : i(i) {} + willthrow_move(std::string s) : i(s) {} willthrow_move(willthrow_move const&) = default; willthrow_move(willthrow_move&& other) : i(other.i) { if (should_throw)