I tried with 1.62 beta and ran into the following problems:


Building with std=c++98 for the following case:


--------------------------------------------------------------------------------

#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_bin_float.hpp>

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<float128_t>());
}
--------------------------------------------------------------------------------

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::number<boost::multiprecision::backends::cpp_bin_float<113u, (boost::multiprecision::backends::digit_base_type)2u, void, short int, -16382, 16383>, (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::number<boost::multiprecision::backends::cpp_bin_float<113u, (boost::multiprecision::backends::digit_base_type)2u, void, short int, -16382, 16383>, (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::number<boost::multiprecision::backends::cpp_bin_float<113u, (boost::multiprecision::backends::digit_base_type)2u, void, short int, -16382, 16383>, (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::number<boost::multiprecision::backends::cpp_bin_float<113u, (boost::multiprecision::backends::digit_base_type)2u, void, short int, -16382, 16383>, (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::number<boost::multiprecision::backends::cpp_bin_float<113u, (boost::multiprecision::backends::digit_base_type)2u, void, short int, -16382, 16383>, (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::number<boost::multiprecision::backends::cpp_bin_float<113u, (boost::multiprecision::backends::digit_base_type)2u, void, short int, -16382, 16383>, (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::number<boost::multiprecision::backends::cpp_bin_float<113u, (boost::multiprecision::backends::digit_base_type)2u, void, short int, -16382, 16383>, (boost::multiprecision::expression_template_option)0u>, __int128 unsigned, boost::multiprecision::number<boost::multiprecision::backends::cpp_bin_float<113u, (boost::multiprecision::backends::digit_base_type)2u, void, short int, -16382, 16383>, (boost::multiprecision::expression_template_option)0u>, __int128 unsigned>’
./boost/type_traits/common_type.hpp:139:37:   required from ‘struct boost::common_type<boost::multiprecision::number<boost::multiprecision::backends::cpp_bin_float<113u, (boost::multiprecision::backends::digit_base_type)2u, void, short int, -16382, 16383>, (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<boost::multiprecision::backends::cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && boost::multiprecision::is_signed_number<boost::multiprecision::backends::cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value)>::type boost::multiprecision::backends::eval_convert_to(R*, const boost::multiprecision::backends::cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1>&) [with R = boost::multiprecision::number<boost::multiprecision::backends::cpp_bin_float<113u, (boost::multiprecision::backends::digit_base_type)2u, void, short int, -16382, 16383>, (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<boost::multiprecision::backends::cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value && boost::multiprecision::is_signed_number<boost::multiprecision::backends::cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> >::value)>::type = void]’
./boost/multiprecision/number.hpp:585:40:   required from ‘void boost::multiprecision::number<Backend, ExpressionTemplates>::convert_to_imp(T*) const [with T = boost::multiprecision::number<boost::multiprecision::backends::cpp_bin_float<113u, (boost::multiprecision::backends::digit_base_type)2u, void, short int, -16382, 16383>, (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<Backend, ExpressionTemplates>::convert_to() const [with T = boost::multiprecision::number<boost::multiprecision::backends::cpp_bin_float<113u, (boost::multiprecision::backends::digit_base_type)2u, void, short int, -16382, 16383>, (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::backends::cpp_bin_float<113u, (boost::multiprecision::backends::digit_base_type)2u, void, short int, -16382, 16383>, (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 <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_bin_float.hpp>

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<int128_t>());
}
--------------------------------------------------------------------------------

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<boost::multiprecision::number<B1, et> >*, 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<boost::multiprecision::backends::cpp_int_backend<128u, 128u, (boost::multiprecision::cpp_integer_type)1u, (boost::multiprecision::cpp_int_check_type)0u, void> >; 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<Backend, ExpressionTemplates>::convert_to_imp(T*) const [with T = boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<128u, 128u, (boost::multiprecision::cpp_integer_type)1u, (boost::multiprecision::cpp_int_check_type)0u, void> >; 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<Backend, ExpressionTemplates>::convert_to() const [with T = boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<128u, 128u, (boost::multiprecision::cpp_integer_type)1u, (boost::multiprecision::cpp_int_check_type)0u, void> >; 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::backends::cpp_int_backend<128u, 128u, (boost::multiprecision::cpp_integer_type)1u, (boost::multiprecision::cpp_int_check_type)0u, void> >, boost::multiprecision::number_category<boost::multiprecision::backends::cpp_bin_float<113u, (boost::multiprecision::backends::digit_base_type)2u, void, short int, -16382, 16383> >)’
    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<class To, class From> 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_<number_kind_floating_point>& /*to_type*/, const mpl::int_<number_kind_integer>& /*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<boost::multiprecision::backends::cpp_int_backend<128u, 128u, (boost::multiprecision::cpp_integer_type)1u, (boost::multiprecision::cpp_int_check_type)0u, void> >()’ (type ‘boost::multiprecision::number_category<boost::multiprecision::backends::cpp_int_backend<128u, 128u, (boost::multiprecision::cpp_integer_type)1u, (boost::multiprecision::cpp_int_check_type)0u, void> >’) 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<class To, class From> 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_<number_kind_integer>& /*to_type*/, const mpl::int_<number_kind_integer>& /*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<boost::multiprecision::backends::cpp_bin_float<113u, (boost::multiprecision::backends::digit_base_type)2u, void, short int, -16382, 16383> >()’ (type ‘boost::multiprecision::number_category<boost::multiprecision::backends::cpp_bin_float<113u, (boost::multiprecision::backends::digit_base_type)2u, void, short int, -16382, 16383> >’) 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<class To, class From> 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_<number_kind_floating_point>& /*to_type*/, const mpl::int_<number_kind_floating_point>& /*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<boost::multiprecision::backends::cpp_int_backend<128u, 128u, (boost::multiprecision::cpp_integer_type)1u, (boost::multiprecision::cpp_int_check_type)0u, void> >()’ (type ‘boost::multiprecision::number_category<boost::multiprecision::backends::cpp_int_backend<128u, 128u, (boost::multiprecision::cpp_integer_type)1u, (boost::multiprecision::cpp_int_check_type)0u, void> >’) 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<class To, class From> 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_<number_kind_rational>& /*to_type*/, const mpl::int_<number_kind_rational>& /*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<boost::multiprecision::backends::cpp_int_backend<128u, 128u, (boost::multiprecision::cpp_integer_type)1u, (boost::multiprecision::cpp_int_check_type)0u, void> >()’ (type ‘boost::multiprecision::number_category<boost::multiprecision::backends::cpp_int_backend<128u, 128u, (boost::multiprecision::cpp_integer_type)1u, (boost::multiprecision::cpp_int_check_type)0u, void> >’) 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<class To, class From> 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_<number_kind_rational>& /*to_type*/, const mpl::int_<number_kind_integer>& /*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<boost::multiprecision::backends::cpp_int_backend<128u, 128u, (boost::multiprecision::cpp_integer_type)1u, (boost::multiprecision::cpp_int_check_type)0u, void> >()’ (type ‘boost::multiprecision::number_category<boost::multiprecision::backends::cpp_int_backend<128u, 128u, (boost::multiprecision::cpp_integer_type)1u, (boost::multiprecision::cpp_int_check_type)0u, void> >’) 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 <boost-users-bounces@lists.boost.org> on behalf of John Maddock <jz.maddock@googlemail.com>
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/339818c0180d0719852b3e648b8d76f2ba02e32d

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 <boost-users-bounces@lists.boost.org> on behalf of
> John Maddock <jz.maddock@googlemail.com>
> *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 <boost/multiprecision/cpp_int.hpp>
> > #include <boost/multiprecision/cpp_bin_float.hpp>
> >
> > 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<float128_t>());
> >    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