https://issues.dlang.org/show_bug.cgi?id=14340

--- Comment #5 from Ivan Kazmenko <[email protected]> ---
(In reply to Xinok from comment #3)
> ... The predicate is expected to define a total order [1]
> which your predicate does not.

But it does!  The order is "x < y if:
(1) number of xs in the array is greater than number of ys,
(2) if (1) is equal, just use ascending order".

Nothing wrong about that.

There's an even simpler example in the added unittest here involving only
count:

https://github.com/GassaFM/phobos/commit/fb6e4ddfcad656b8093aa51cf59726cf38e2cfbe

What's wrong is optimisticInsertionSort overwriting elements while hiding one
of them in a temporary variable, and calling the predicate all the way while
the array is in an invalid state.

--

Reply via email to