Re: [Boost-bugs] [Boost C++ Libraries] #12299: User-defined conversion operator from a wrapper class to a boost/multiprecision floating-point type does not compile.

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #12299: User-defined conversion operator from a wrapper class to a boost/multiprecision floating-point type does not compile.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-06-24 17:41:50


#12299: User-defined conversion operator from a wrapper class to a
boost/multiprecision floating-point type does not compile.
-------------------------------------------+----------------------------
  Reporter: Ulrich Mutze <ulrichmutze@…> | Owner: johnmaddock
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: multiprecision
   Version: Boost 1.61.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------------------+----------------------------

Comment (by johnmaddock):

 I'm having a hard time figuring out why this would work for type double
 actually - though it clearly does so.... do you have a reference to which
 part of the standard requires the conversion operators to be invoked in
 this case?

 BTW if you typedef R to complex<double> it fails for the same reason as
 Boost does.

 A quick and dirty workaround would be to add arithmetic operators for type
 R1:

 {{{
 inline R operator+(const R1& a, const R1& b) { return (R)a + (R)b; }
 }}}

 I could also add more overloaded operators for type number to handle this
 specific case, but I'm not entirely sure what the consequences would be
 (other than even longer compile times).

 Thanks for reporting this, it's an interesting and somewhat perplexing
 corner case...!

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12299#comment:1>
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-02-16 18:50:20 UTC