Skip to content

Commit

Permalink
reverting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
zajo committed Sep 27, 2024
1 parent b65362d commit 7501e79
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 69 deletions.
3 changes: 1 addition & 2 deletions include/boost/leaf/error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -656,8 +656,7 @@ class BOOST_LEAF_SYMBOL_VISIBLE error_id
}

#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR
template <class T>
explicit error_id( T const & ec, typename std::enable_if<!std::is_error_code_enum<T>::value && std::is_constructible<std::error_code, T>::value, int>::type = 0 ) noexcept:
explicit error_id( std::error_code const & ec ) noexcept:
value_(detail::import_error_code(std::error_code(ec)))
{
BOOST_LEAF_ASSERT(!value_ || ((value_&3) == 1));
Expand Down
10 changes: 0 additions & 10 deletions include/boost/leaf/result.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,16 +234,6 @@ class BOOST_LEAF_SYMBOL_VISIBLE BOOST_LEAF_ATTRIBUTE_NODISCARD result
}
}

#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR
operator std::error_code() const noexcept
{
result_discriminant const what = r_.what_;
return what.kind() == result_discriminant::val?
std::error_code() :
std::error_code(what.get_error_id_value(), detail::get_leaf_error_category<>::cat);
}
#endif

operator error_id() const noexcept
{
result_discriminant const what = r_.what_;
Expand Down
57 changes: 0 additions & 57 deletions test/result_state_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,6 @@ int main()
BOOST_TEST_EQ(err::count, 1);
BOOST_TEST_EQ(val::count, 0);
leaf::error_id r1e = r1.error();
#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR
BOOST_TEST(std::error_code(r1e) == r1.error());
#endif
leaf::result<val> r2 = std::move(r1);
leaf::error_id r2e = r2.error();
BOOST_TEST_EQ(r1e, r2e);
Expand All @@ -249,9 +246,6 @@ int main()
BOOST_TEST_EQ(err::count, 1);
BOOST_TEST_EQ(val::count, 0);
leaf::error_id r1e = r1.error();
#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR
BOOST_TEST(std::error_code(r1e) == r1.error());
#endif
leaf::result<val> r2 = std::move(r1);
leaf::error_id r2e = r2.error();
BOOST_TEST_EQ(r1e, r2e);
Expand All @@ -269,9 +263,6 @@ int main()
BOOST_TEST_EQ(err::count, 1);
BOOST_TEST_EQ(val::count, 0);
leaf::error_id r1e = r1.error();
#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR
BOOST_TEST(std::error_code(r1e) == r1.error());
#endif
leaf::result<val> r2; r2=std::move(r1);
leaf::error_id r2e = r2.error();
BOOST_TEST_EQ(r1e, r2e);
Expand All @@ -294,9 +285,6 @@ int main()
BOOST_TEST_EQ(err::count, 1);
BOOST_TEST_EQ(val::count, 0);
leaf::error_id r1e = r1.error();
#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR
BOOST_TEST(std::error_code(r1e) == r1.error());
#endif
leaf::result<val> r2; r2=std::move(r1);
leaf::error_id r2e = r2.error();
BOOST_TEST_EQ(r1e, r2e);
Expand All @@ -316,9 +304,6 @@ int main()
BOOST_TEST_EQ(err::count, 1);
BOOST_TEST_EQ(val::count, 0);
leaf::error_id r1e = r1.error();
#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR
BOOST_TEST(std::error_code(r1e) == r1.error());
#endif
leaf::result<val> r2 = std::move(r1);
leaf::error_id r2e = r2.error();
BOOST_TEST_EQ(r1e, r2e);
Expand All @@ -338,9 +323,6 @@ int main()
BOOST_TEST_EQ(err::count, 1);
BOOST_TEST_EQ(val::count, 0);
leaf::error_id r1e = r1.error();
#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR
BOOST_TEST(std::error_code(r1e) == r1.error());
#endif
leaf::result<val> r2 = std::move(r1);
leaf::error_id r2e = r2.error();
BOOST_TEST_EQ(r1e, r2e);
Expand All @@ -360,9 +342,6 @@ int main()
BOOST_TEST_EQ(err::count, 1);
BOOST_TEST_EQ(val::count, 0);
leaf::error_id r1e = r1.error();
#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR
BOOST_TEST(std::error_code(r1e) == r1.error());
#endif
leaf::result<val> r2; r2=std::move(r1);
leaf::error_id r2e = r2.error();
BOOST_TEST_EQ(r1e, r2e);
Expand All @@ -382,9 +361,6 @@ int main()
BOOST_TEST_EQ(err::count, 1);
BOOST_TEST_EQ(val::count, 0);
leaf::error_id r1e = r1.error();
#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR
BOOST_TEST(std::error_code(r1e) == r1.error());
#endif
leaf::result<val> r2; r2=std::move(r1);
leaf::error_id r2e = r2.error();
BOOST_TEST_EQ(r1e, r2e);
Expand Down Expand Up @@ -438,9 +414,6 @@ int main()
BOOST_TEST(!r1.operator->());
BOOST_TEST_EQ(err::count, 1);
leaf::error_id r1e = r1.error();
#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR
BOOST_TEST(std::error_code(r1e) == r1.error());
#endif
leaf::result<void> r2 = std::move(r1);
leaf::error_id r2e = r2.error();
BOOST_TEST_EQ(r1e, r2e);
Expand All @@ -457,9 +430,6 @@ int main()
BOOST_TEST(!r1.operator->());
BOOST_TEST_EQ(err::count, 1);
leaf::error_id r1e = r1.error();
#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR
BOOST_TEST(std::error_code(r1e) == r1.error());
#endif
leaf::result<void> r2 = std::move(r1);
leaf::error_id r2e = r2.error();
BOOST_TEST_EQ(r1e, r2e);
Expand All @@ -477,9 +447,6 @@ int main()
BOOST_TEST(!r1.operator->());
BOOST_TEST_EQ(err::count, 1);
leaf::error_id r1e = r1.error();
#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR
BOOST_TEST(std::error_code(r1e) == r1.error());
#endif
leaf::result<void> r2; r2=std::move(r1);
leaf::error_id r2e = r2.error();
BOOST_TEST_EQ(r1e, r2e);
Expand All @@ -498,9 +465,6 @@ int main()
BOOST_TEST(!r1.operator->());
BOOST_TEST_EQ(err::count, 1);
leaf::error_id r1e = r1.error();
#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR
BOOST_TEST(std::error_code(r1e) == r1.error());
#endif
leaf::result<void> r2; r2=std::move(r1);
leaf::error_id r2e = r2.error();
BOOST_TEST_EQ(r1e, r2e);
Expand All @@ -520,9 +484,6 @@ int main()
BOOST_TEST(!r1.operator->());
BOOST_TEST_EQ(err::count, 1);
leaf::error_id r1e = r1.error();
#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR
BOOST_TEST(std::error_code(r1e) == r1.error());
#endif
leaf::result<void> r2 = std::move(r1);
leaf::error_id r2e = r2.error();
BOOST_TEST_EQ(r1e, r2e);
Expand All @@ -541,9 +502,6 @@ int main()
BOOST_TEST(!r1.operator->());
BOOST_TEST_EQ(err::count, 1);
leaf::error_id r1e = r1.error();
#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR
BOOST_TEST(std::error_code(r1e) == r1.error());
#endif
leaf::result<void> r2 = std::move(r1);
leaf::error_id r2e = r2.error();
BOOST_TEST_EQ(r1e, r2e);
Expand All @@ -562,9 +520,6 @@ int main()
BOOST_TEST(!r1.operator->());
BOOST_TEST_EQ(err::count, 1);
leaf::error_id r1e = r1.error();
#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR
BOOST_TEST(std::error_code(r1e) == r1.error());
#endif
leaf::result<void> r2; r2=std::move(r1);
leaf::error_id r2e = r2.error();
BOOST_TEST_EQ(r1e, r2e);
Expand All @@ -583,9 +538,6 @@ int main()
BOOST_TEST(!r1.operator->());
BOOST_TEST_EQ(err::count, 1);
leaf::error_id r1e = r1.error();
#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR
BOOST_TEST(std::error_code(r1e) == r1.error());
#endif
leaf::result<void> r2; r2=std::move(r1);
leaf::error_id r2e = r2.error();
BOOST_TEST_EQ(r1e, r2e);
Expand Down Expand Up @@ -620,9 +572,6 @@ int main()
BOOST_TEST_EQ(val::count, 0);
BOOST_TEST(!r1);
leaf::error_id id = r.error();
#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR
BOOST_TEST(!std::error_code(r.error()));
#endif
BOOST_TEST(!id);
}
BOOST_TEST_EQ(val::count, 0);
Expand All @@ -633,9 +582,6 @@ int main()
leaf::result<void> r1 = r.error();
BOOST_TEST(!r1);
leaf::error_id id = r.error();
#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR
BOOST_TEST(!std::error_code(r.error()));
#endif
BOOST_TEST(!id);
BOOST_TEST_EQ(val::count, 1);
}
Expand All @@ -647,9 +593,6 @@ int main()
leaf::result<float> r1 = r.error();
BOOST_TEST(!r1);
leaf::error_id id = r.error();
#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR
BOOST_TEST(!std::error_code(r.error()));
#endif
BOOST_TEST(!id);
BOOST_TEST_EQ(val::count, 1);
}
Expand Down

0 comments on commit 7501e79

Please sign in to comment.