I tried with 1.62 beta and ran into the following problems:
Building with std=c++98 for the following case:
--------------------------------------------------------------------------------
#include
#include
typedef boost::multiprecision::int128_t int128_t;
typedef boost::multiprecision::cpp_bin_float_quad float128_t;
void func()
{
int128_t iVal;
float128_t floatVal(iVal.convert_to());
}
--------------------------------------------------------------------------------
In file included from ./boost/type_traits/detail/common_type_impl.hpp:12:0,
from ./boost/type_traits/common_type.hpp:18,
from ./boost/multiprecision/cpp_int.hpp:22,
from mpTest.cpp:1:
./boost/type_traits/detail/common_arithmetic_type.hpp: In instantiation of ‘class boost::type_traits_detail::common_arithmetic_type, (boost::multiprecision::expression_template_option)0u>, __int128 unsigned>’:
./boost/type_traits/detail/common_type_impl.hpp:99:35: required from ‘struct boost::type_traits_detail::common_type_impl5, (boost::multiprecision::expression_template_option)0u>, __int128 unsigned>’
./boost/type_traits/detail/common_type_impl.hpp:90:35: required from ‘struct boost::type_traits_detail::common_type_impl4, (boost::multiprecision::expression_template_option)0u>, __int128 unsigned>’
./boost/type_traits/detail/common_type_impl.hpp:79:35: required from ‘struct boost::type_traits_detail::common_type_impl3, (boost::multiprecision::expression_template_option)0u>, __int128 unsigned>’
./boost/type_traits/detail/common_type_impl.hpp:52:35: required from ‘struct boost::type_traits_detail::common_type_class, (boost::multiprecision::expression_template_option)0u>, __int128 unsigned>’
./boost/type_traits/detail/common_type_impl.hpp:68:35: required from ‘struct boost::type_traits_detail::common_type_impl, (boost::multiprecision::expression_template_option)0u>, __int128 unsigned>’
./boost/type_traits/common_type.hpp:133:37: required from ‘struct boost::type_traits_detail::common_type_decay_helper, (boost::multiprecision::expression_template_option)0u>, __int128 unsigned, boost::multiprecision::number, (boost::multiprecision::expression_template_option)0u>, __int128 unsigned>’
./boost/type_traits/common_type.hpp:139:37: required from ‘struct boost::common_type, (boost::multiprecision::expression_template_option)0u>, __int128 unsigned, void, void, void, void, void, void, void>’
./boost/multiprecision/cpp_int/misc.hpp:547:138: required from ‘typename boost::enable_if_c<(boost::multiprecision::backends::is_trivial_cpp_int >::value && boost::multiprecision::is_signed_number >::value)>::type boost::multiprecision::backends::eval_convert_to(R*, const boost::multiprecision::backends::cpp_int_backend&) [with R = boost::multiprecision::number, (boost::multiprecision::expression_template_option)0u>; unsigned int MinBits1 = 128u; unsigned int MaxBits1 = 128u; boost::multiprecision::cpp_integer_type SignType1 = (boost::multiprecision::cpp_integer_type)1u; boost::multiprecision::cpp_int_check_type Checked1 = (boost::multiprecision::cpp_int_check_type)0u; Allocator1 = void; typename boost::enable_if_c<(boost::multiprecision::backends::is_trivial_cpp_int >::value && boost::multiprecision::is_signed_number >::value)>::type = void]’
./boost/multiprecision/number.hpp:585:40: required from ‘void boost::multiprecision::number::convert_to_imp(T*) const [with T = boost::multiprecision::number, (boost::multiprecision::expression_template_option)0u>; Backend = boost::multiprecision::backends::cpp_int_backend<128u, 128u, (boost::multiprecision::cpp_integer_type)1u, (boost::multiprecision::cpp_int_check_type)0u, void>; boost::multiprecision::expression_template_option ExpressionTemplates = (boost::multiprecision::expression_template_option)0u]’
./boost/multiprecision/number.hpp:601:29: required from ‘T boost::multiprecision::number::convert_to() const [with T = boost::multiprecision::number, (boost::multiprecision::expression_template_option)0u>; Backend = boost::multiprecision::backends::cpp_int_backend<128u, 128u, (boost::multiprecision::cpp_integer_type)1u, (boost::multiprecision::cpp_int_check_type)0u, void>; boost::multiprecision::expression_template_option ExpressionTemplates = (boost::multiprecision::expression_template_option)0u]’
mpTest.cpp:11:52: required from here
./boost/type_traits/detail/common_arithmetic_type.hpp:211:60: error: no match for ternary ‘operator?:’ (operand types are ‘bool’, ‘boost::multiprecision::number, (boost::multiprecision::expression_template_option)0u>’, and ‘__int128 unsigned’)
typedef typename arithmetic_type< sizeof(select( cond()? T(): U() )) >::type type;
Building without a std specified I get the following case:
--------------------------------------------------------------------------------
#include
#include
typedef boost::multiprecision::int128_t int128_t;
typedef boost::multiprecision::cpp_bin_float_quad float128_t;
void func()
{
float128_t floatVal;
int128_t roundedNanoseconds(floatVal.convert_to());
}
--------------------------------------------------------------------------------
In file included from ./boost/multiprecision/detail/generic_interconvert.hpp:9:0,
from ./boost/multiprecision/number.hpp:22,
from ./boost/multiprecision/cpp_int.hpp:12,
from mpTest.cpp:1:
./boost/multiprecision/detail/default_ops.hpp: In instantiation of ‘void boost::multiprecision::default_ops::eval_convert_to(boost::multiprecision::default_ops::terminal >*, const B2&) [with B1 = boost::multiprecision::backends::cpp_int_backend<128u, 128u, (boost::multiprecision::cpp_integer_type)1u, (boost::multiprecision::cpp_int_check_type)0u, void>; B2 = boost::multiprecision::backends::cpp_bin_float<113u, (boost::multiprecision::backends::digit_base_type)2u, void, short int, -16382, 16383>; boost::multiprecision::expression_template_option et = (boost::multiprecision::expression_template_option)0u]’:
./boost/multiprecision/detail/default_ops.hpp:896:31: required from ‘void boost::multiprecision::default_ops::eval_convert_to(R*, const B&) [with R = boost::multiprecision::number >; B = boost::multiprecision::backends::cpp_bin_float<113u, (boost::multiprecision::backends::digit_base_type)2u, void, short int, -16382, 16383>]’
./boost/multiprecision/number.hpp:585:40: required from ‘void boost::multiprecision::number::convert_to_imp(T*) const [with T = boost::multiprecision::number >; Backend = boost::multiprecision::backends::cpp_bin_float<113u, (boost::multiprecision::backends::digit_base_type)2u, void, short int, -16382, 16383>; boost::multiprecision::expression_template_option ExpressionTemplates = (boost::multiprecision::expression_template_option)0u]’
./boost/multiprecision/number.hpp:601:29: required from ‘T boost::multiprecision::number::convert_to() const [with T = boost::multiprecision::number >; Backend = boost::multiprecision::backends::cpp_bin_float<113u, (boost::multiprecision::backends::digit_base_type)2u, void, short int, -16382, 16383>; boost::multiprecision::expression_template_option ExpressionTemplates = (boost::multiprecision::expression_template_option)0u]’
mpTest.cpp:11:62: required from here
./boost/multiprecision/detail/default_ops.hpp:922:134: error: no matching function for call to ‘generic_interconvert(boost::multiprecision::backends::cpp_int_backend<128u, 128u, (boost::multiprecision::cpp_integer_type)1u, (boost::multiprecision::cpp_int_check_type)0u, void>&, const boost::multiprecision::backends::cpp_bin_float<113u, (boost::multiprecision::backends::digit_base_type)2u, void, short int, -16382, 16383>&, boost::multiprecision::number_category >, boost::multiprecision::number_category >)’
boost::multiprecision::detail::generic_interconvert(result->value.backend(), backend, number_category<B1>(), number_category<B2>());
^
./boost/multiprecision/detail/default_ops.hpp:922:134: note: candidates are:
In file included from ./boost/multiprecision/number.hpp:22:0,
from ./boost/multiprecision/cpp_int.hpp:12,
from mpTest.cpp:1:
./boost/multiprecision/detail/generic_interconvert.hpp:30:6: note: template void boost::multiprecision::detail::generic_interconvert(To&, const From&, const mpl_::int_<1>&, const mpl_::int_<0>&)
void generic_interconvert(To& to, const From& from, const mpl::int_& /*to_type*/, const mpl::int_& /*from_type*/)
^
./boost/multiprecision/detail/generic_interconvert.hpp:30:6: note: template argument deduction/substitution failed:
In file included from ./boost/multiprecision/detail/generic_interconvert.hpp:9:0,
from ./boost/multiprecision/number.hpp:22,
from ./boost/multiprecision/cpp_int.hpp:12,
from mpTest.cpp:1:
./boost/multiprecision/detail/default_ops.hpp:922:134: note: cannot convert ‘boost::multiprecision::number_category >()’ (type ‘boost::multiprecision::number_category >’) to type ‘const mpl_::int_<1>&’
boost::multiprecision::detail::generic_interconvert(result->value.backend(), backend, number_category<B1>(), number_category<B2>());
^
In file included from ./boost/multiprecision/number.hpp:22:0,
from ./boost/multiprecision/cpp_int.hpp:12,
from mpTest.cpp:1:
./boost/multiprecision/detail/generic_interconvert.hpp:78:6: note: template void boost::multiprecision::detail::generic_interconvert(To&, const From&, const mpl_::int_<0>&, const mpl_::int_<0>&)
void generic_interconvert(To& to, const From& from, const mpl::int_& /*to_type*/, const mpl::int_& /*from_type*/)
^
./boost/multiprecision/detail/generic_interconvert.hpp:78:6: note: template argument deduction/substitution failed:
In file included from ./boost/multiprecision/detail/generic_interconvert.hpp:9:0,
from ./boost/multiprecision/number.hpp:22,
from ./boost/multiprecision/cpp_int.hpp:12,
from mpTest.cpp:1:
./boost/multiprecision/detail/default_ops.hpp:922:134: note: cannot convert ‘boost::multiprecision::number_category >()’ (type ‘boost::multiprecision::number_category >’) to type ‘const mpl_::int_<0>&’
boost::multiprecision::detail::generic_interconvert(result->value.backend(), backend, number_category<B1>(), number_category<B2>());
^
In file included from ./boost/multiprecision/number.hpp:22:0,
from ./boost/multiprecision/cpp_int.hpp:12,
from mpTest.cpp:1:
./boost/multiprecision/detail/generic_interconvert.hpp:126:6: note: template void boost::multiprecision::detail::generic_interconvert(To&, const From&, const mpl_::int_<1>&, const mpl_::int_<1>&)
void generic_interconvert(To& to, const From& from, const mpl::int_& /*to_type*/, const mpl::int_& /*from_type*/)
^
./boost/multiprecision/detail/generic_interconvert.hpp:126:6: note: template argument deduction/substitution failed:
In file included from ./boost/multiprecision/detail/generic_interconvert.hpp:9:0,
from ./boost/multiprecision/number.hpp:22,
from ./boost/multiprecision/cpp_int.hpp:12,
from mpTest.cpp:1:
./boost/multiprecision/detail/default_ops.hpp:922:134: note: cannot convert ‘boost::multiprecision::number_category >()’ (type ‘boost::multiprecision::number_category >’) to type ‘const mpl_::int_<1>&’
boost::multiprecision::detail::generic_interconvert(result->value.backend(), backend, number_category<B1>(), number_category<B2>());
^
In file included from ./boost/multiprecision/number.hpp:22:0,
from ./boost/multiprecision/cpp_int.hpp:12,
from mpTest.cpp:1:
./boost/multiprecision/detail/generic_interconvert.hpp:209:6: note: template void boost::multiprecision::detail::generic_interconvert(To&, const From&, const mpl_::int_<2>&, const mpl_::int_<2>&)
void generic_interconvert(To& to, const From& from, const mpl::int_& /*to_type*/, const mpl::int_& /*from_type*/)
^
./boost/multiprecision/detail/generic_interconvert.hpp:209:6: note: template argument deduction/substitution failed:
In file included from ./boost/multiprecision/detail/generic_interconvert.hpp:9:0,
from ./boost/multiprecision/number.hpp:22,
from ./boost/multiprecision/cpp_int.hpp:12,
from mpTest.cpp:1:
./boost/multiprecision/detail/default_ops.hpp:922:134: note: cannot convert ‘boost::multiprecision::number_category >()’ (type ‘boost::multiprecision::number_category >’) to type ‘const mpl_::int_<2>&’
boost::multiprecision::detail::generic_interconvert(result->value.backend(), backend, number_category<B1>(), number_category<B2>());
^
In file included from ./boost/multiprecision/number.hpp:22:0,
from ./boost/multiprecision/cpp_int.hpp:12,
from mpTest.cpp:1:
./boost/multiprecision/detail/generic_interconvert.hpp:220:6: note: template void boost::multiprecision::detail::generic_interconvert(To&, const From&, const mpl_::int_<2>&, const mpl_::int_<0>&)
void generic_interconvert(To& to, const From& from, const mpl::int_& /*to_type*/, const mpl::int_& /*from_type*/)
^
./boost/multiprecision/detail/generic_interconvert.hpp:220:6: note: template argument deduction/substitution failed:
In file included from ./boost/multiprecision/detail/generic_interconvert.hpp:9:0,
from ./boost/multiprecision/number.hpp:22,
from ./boost/multiprecision/cpp_int.hpp:12,
from mpTest.cpp:1:
./boost/multiprecision/detail/default_ops.hpp:922:134: note: cannot convert ‘boost::multiprecision::number_category >()’ (type ‘boost::multiprecision::number_category >’) to type ‘const mpl_::int_<2>&’
boost::multiprecision::detail::generic_interconvert(result->value.backend(), backend, number_category<B1>(), number_category<B2>());
^
Rob
________________________________
From: Boost-users on behalf of John Maddock
Sent: Thursday, August 18, 2016 12:14:06 PM
To: boost-users@lists.boost.org
Subject: Re: [Boost-users] [boost][multiprecision] compile error with gcc 4.8.4
On 18/08/2016 15:05, Rob Conde wrote:
Any luck? It would be great if there was a fix in boost 1.62.
Fixed in
https://github.com/boostorg/multiprecision/commit/339818c0180d0719852b3e648b...
If the tests cycle OK, I'll try to get this into 1.62, but it's tight now.
John.
Thanks,
Rob
------------------------------------------------------------------------
*From:* Boost-users on behalf of
John Maddock
*Sent:* Tuesday, August 16, 2016 7:11:07 AM
*To:* boost-users@lists.boost.org
*Subject:* Re: [Boost-users] [boost][multiprecision] compile error
with gcc 4.8.4
On 16/08/2016 01:59, Rob Conde wrote:
#include
#include
typedef boost::multiprecision::int128_t int128_t;
typedef boost::multiprecision::cpp_bin_float_quad float128_t;
int main()
{
int128_t intVal;
float128_t floatVal(intVal.convert_to());
return 0;
}
That should work, as should:
float128_t f(intVal);
However, while both of these do work with msvc, they fail with GCC, so
there is a bug (or 2) somewhere. I'll investigate later.
John.
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users