[Boost-bugs] [Boost C++ Libraries] #13124: Boost Multiprecision: Compilation error on MSVC2017 with MPIR 3.0.0

Subject: [Boost-bugs] [Boost C++ Libraries] #13124: Boost Multiprecision: Compilation error on MSVC2017 with MPIR 3.0.0
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-07-16 08:18:20


#13124: Boost Multiprecision: Compilation error on MSVC2017 with MPIR 3.0.0
-------------------------------------------------+-------------------------
 Reporter: Porama Ruengrairatanaroj | Owner: John
  <seal.corner@…> | Maddock
     Type: Bugs | Status: new
Milestone: To Be Determined | Component:
                                                 | multiprecision
  Version: Boost 1.64.0 | Severity: Showstopper
 Keywords: |
-------------------------------------------------+-------------------------
 I'm getting the following compilation error when attempting to use MPIR
 3.0.0 as backend for Boost Multiprecision:

 {{{
 C:\dev\boost\boost\multiprecision\gmp.hpp(1008): error C2664: 'double
 __gmpf_get_d_2exp(long *,mpf_srcptr)': cannot convert argument 1 from
 'mpir_si *' to 'long *'
     C:\dev\boost\boost/multiprecision/gmp.hpp(1008): note: Types pointed
 to are unrelated; conversion requires reinterpret_cast, C-style cast or
 function-style cast
 }}}

 I've also confirmed that this issue doesn't happen on the previous MPIR
 release (2.7.2).

 At the moment, changing the version guard here:
 {{{
 template <unsigned Digits10>
 inline void eval_frexp(gmp_float<Digits10>& result, const
 gmp_float<Digits10>& val, long* e)
 {
 #if BOOST_MP_MPIR_VERSION >= 20600
    mpir_si v;
    mpf_get_d_2exp(&v, val.data());
    *e = v;
    eval_ldexp(result, val, -v);
 #else
    mpf_get_d_2exp(e, val.data());
    eval_ldexp(result, val, -*e);
 #endif
 }
 }}}

 to:

 {{{
 #if BOOST_MP_MPIR_VERSION >= 20600 && BOOST_MP_MPIR_VERSION < 30000
 }}}

 eliminates the error, though I don't know enough about this to determine
 whether more changes will be needed (like the similar looking guard in the
 int* overload of this function).

 The issue also occurs in Boost v1.65 beta 1, so I assume it hasn't been
 fixed yet. I'm guessing this is a consequence of the fix from
 [https://svn.boost.org/trac10/ticket/12234].

 I just used gmp_snips.cpp from the Boost examples to reproduce this, so I
 won't attach the code here.

 **For reference:** all of the stated tests and the MPIR sources were
 compiled on MSVC2017 (x64, Debug), but I doubt that would change anything.

-- 
Ticket URL: <https://svn.boost.org/trac10/boost/ticket/13124>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-07-16 08:21:31 UTC