mirror of
https://github.com/boostorg/multiprecision.git
synced 2026-02-19 14:32:35 +00:00
Multiprecision: disable explicit conversion operator if the target type is already constructible from *this.
Prevents ambiguity between the target types constructor and the conversion operator. See https://github.com/boostorg/multiprecision/issues/30.
This commit is contained in:
@@ -628,8 +628,12 @@ public:
|
||||
return this->template convert_to<T>();
|
||||
}
|
||||
# else
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1900)
|
||||
template <class T>
|
||||
explicit operator T()const
|
||||
#else
|
||||
template <class T, class = typename boost::disable_if_c<boost::is_constructible<T, self_type const&>::value || !boost::is_default_constructible<T>::value, T>::type>
|
||||
#endif
|
||||
explicit operator T ()const
|
||||
{
|
||||
return this->template convert_to<T>();
|
||||
}
|
||||
|
||||
@@ -863,6 +863,7 @@ run test_float_conversions.cpp no_eh_support ;
|
||||
#
|
||||
compile bug11922.cpp ;
|
||||
run bug12039.cpp no_eh_support ;
|
||||
compile git_issue_30.cpp ;
|
||||
run test_hash.cpp : : :
|
||||
[ check-target-builds ../config//has_float128 : <define>TEST_FLOAT128 <source>quadmath : ]
|
||||
[ check-target-builds ../config//has_gmp : <define>TEST_GMP <source>gmp : ]
|
||||
|
||||
Reference in New Issue
Block a user