Add a deleted T const& conversion for clang-6 and earlier

This commit is contained in:
Peter Dimov
2021-06-14 02:35:48 +03:00
parent 5b1909eba4
commit a6c4b6329c

View File

@@ -330,7 +330,7 @@ public:
{ {
if( flags_ != 1 ) if( flags_ != 1 )
{ {
std::error_code e2 = *this; std::error_code e2( *this );
::new( d2_ ) std::error_code( e2 ); ::new( d2_ ) std::error_code( e2 );
flags_ = 1; flags_ = 1;
} }
@@ -338,6 +338,14 @@ public:
return *reinterpret_cast<std::error_code*>( d2_ ); return *reinterpret_cast<std::error_code*>( d2_ );
} }
#if defined(__clang__) && __clang_major__ < 7
template<class T,
class E = typename std::enable_if<std::is_same<T, std::error_code>::value>::type>
operator T const& () = delete;
#endif
#endif #endif
template<class Ch, class Tr> template<class Ch, class Tr>