From 8efb96350f487c80b6eb2377b5edbe1862f87008 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Mon, 14 Jun 2021 14:44:07 +0300 Subject: [PATCH] Clang 6 needs more help with mixed comparisons --- include/boost/system/detail/error_code.hpp | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/include/boost/system/detail/error_code.hpp b/include/boost/system/detail/error_code.hpp index f9b5854..0626847 100644 --- a/include/boost/system/detail/error_code.hpp +++ b/include/boost/system/detail/error_code.hpp @@ -364,6 +364,30 @@ public: return !( lhs == rhs ); } +#if defined(BOOST_SYSTEM_CLANG_6) + + inline friend bool operator==( error_code const & lhs, std::error_condition const & rhs ) BOOST_NOEXCEPT + { + return static_cast< std::error_code >( lhs ) == rhs; + } + + inline friend bool operator==( std::error_condition const & lhs, error_code const & rhs ) BOOST_NOEXCEPT + { + return lhs == static_cast< std::error_code >( rhs ); + } + + inline friend bool operator!=( error_code const & lhs, std::error_condition const & rhs ) BOOST_NOEXCEPT + { + return !( lhs == rhs ); + } + + inline friend bool operator!=( std::error_condition const & lhs, error_code const & rhs ) BOOST_NOEXCEPT + { + return !( lhs == rhs ); + } + +#endif + // conversions operator std::error_code () const