[Boost-bugs] [Boost C++ Libraries] #13225: operator != fails in classes derived from boost::rational

Subject: [Boost-bugs] [Boost C++ Libraries] #13225: operator != fails in classes derived from boost::rational
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-09-21 14:47:48


#13225: operator != fails in classes derived from boost::rational
-------------------------------------------------+-------------------------
 Reporter: Michael Hanrath <Michael.Hanrath@…> | Owner: Jonathan
                                                 | Turkanis
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: rational
  Version: Boost 1.64.0 | Severity: Problem
 Keywords: |
-------------------------------------------------+-------------------------
 In a class derived from boost::rational operator != seems to return
 "false" always.

 {{{
 #include <iostream>
 #include <boost/rational.hpp>

 struct RationalNumber : public boost::rational<int> {
         RationalNumber(int n, int d) : boost::rational<int>(n, d) {}
 };

 using namespace std;

 template <typename T> void check()
 {
 T r(2, 3);
 T q(2, 3);
 T s(2, 4);
         cout << (r!=q) << " " << (r!=s) << endl;
 }

 int main()
 {
         check<boost::rational<long long>>(); // works
         cout << "---------------" << endl;
         check<RationalNumber>(); // fails for boost version > 1_63_0
         return 0;
 }

 }}}

 Bug appears since boost version 1_64_0 and is present in current
 development trunk (git repository on 20170921) still.

-- 
Ticket URL: <https://svn.boost.org/trac10/boost/ticket/13225>
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-09-21 14:54:18 UTC