[Bug c++/40186] floating point comparision works wrong ( !(a < b) && (b > a) is true )

ich at az2000 dot de gcc-bugzilla@gcc.gnu.org
Mon May 18 13:16:00 GMT 2009



------- Comment #2 from ich at az2000 dot de  2009-05-18 13:16 -------
This is a real problem, because in my real application, I tried to use a very
similar order in a std::set<tmp*,CustomOrder>, defined like this:

struct CustomOrder {
        bool operator()(const Tmp* a, const Tmp* b) const {
                return a->get() < b->get();
        }
};

STLport gives this assertion when inserting Tmp pointers with equal values
(returned by get() function):

/usr/include/stlport/stl/debug/_tree.h(63): STL error : Invalid strict weak
ordering predicate, if pred(a, b) then we should have !pred(b, a)
/usr/include/stlport/stl/debug/_tree.h(63): STL assertion failure:    
!_M_non_dbg_cmp(__rhs, __lhs) 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40186



More information about the Gcc-bugs mailing list