https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113159
--- Comment #16 from Yury Gribov <ygribov at gcc dot gnu.org> ---
(In reply to Xi Ruoyao from comment #15)
> (In reply to Yury Gribov from comment #14)
> > (In reply to Xi Ruoyao from comment #12)
> > > Also note even
> > >
> > > bool cmp(Element a, Element b) { return false; }
> > >
> > > is a *valid* comparator, per the standard.
> >
> > Hm, doesn't it violate the asymmetry axiom (cmp(x, y) => !cmp(y, x)) ?
>
> No there's no such axiom. cmp(x, y) && !cmp(y, x) just means x and y will
> be treat as equal elements.
Hm, I thought equality is
!cmp(x, y) && !cmp(y, x)
but anyway I think this bug is not a place to discuss details of strict weak
ordering axioms.
By the way I wanted to mention that tools to detect comparator violations (via
O(N^3) as you mentioned) already exist (e.g.
https://github.com/yugr/sortcheckxx).