https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78420
--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> --- (In reply to Tomasz KamiĆski from comment #4) > Oh, you mean that compiler is not allowed to turn comparison of p == b into > false at compile time, using 5.10 [expr.eq] p2.1? No, it's very much allowed to do that. But I'm skeptical that it's allowed to turn !(a<b)&&!(b<a) into false when a<b and b<a are both false. This comment doesn't apply to C, where a<b and b<a are both undefined, but in C++ they're only unspecified, and so I would expect them to be consistent. But Michael Matz disagrees. (In reply to Andrew Pinski from comment #5) > I think this deserves a Defect report to the C++ committee because even > though std::less requires total order, < and <= usage are undefined if used > with two different arrays. Which defect? That just means the implementation has to be more complex, e.g. casting to intptr_t before comparing.