From a6c4b6329c3b8e3d131d007b87ac691dd65dc85a Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Mon, 14 Jun 2021 02:35:48 +0300 Subject: [PATCH] Add a deleted T const& conversion for clang-6 and earlier --- include/boost/system/detail/error_code.hpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/include/boost/system/detail/error_code.hpp b/include/boost/system/detail/error_code.hpp index e434b42..18076cf 100644 --- a/include/boost/system/detail/error_code.hpp +++ b/include/boost/system/detail/error_code.hpp @@ -330,7 +330,7 @@ public: { if( flags_ != 1 ) { - std::error_code e2 = *this; + std::error_code e2( *this ); ::new( d2_ ) std::error_code( e2 ); flags_ = 1; } @@ -338,6 +338,14 @@ public: return *reinterpret_cast( d2_ ); } +#if defined(__clang__) && __clang_major__ < 7 + + template::value>::type> + operator T const& () = delete; + +#endif + #endif template