Comment #0 by dlang-bugzilla — 2017-03-06T23:24:13Z
Comparison of structs without an opCmp is undefined:
struct A { int i; }
static assert(!__traits(compiles, A(1) < A(2) )); // OK
However, comparing arrays of such structs is allowed:
static assert(!__traits(compiles, [A(1)] < [A(2)])); // Fails
Andrei wrote[1]:
> Oh. Yah, that's problematic too - you can't order lexicographically
> unless elements are ordered.
[1]: https://github.com/dlang/druntime/pull/1787#discussion_r104548229
Comment #1 by andrei — 2017-03-06T23:42:26Z
Same problem for
alias A = cfloat;
Comment #2 by qs.il.paperinik — 2020-12-02T02:13:10Z
Probably part of the same problem:
float[1] xs = [ float.nan ];
assert(!(xs[0] <= xs[0] || xs[0] >= xs[0]));
assert(xs != xs);
assert(xs <= xs && xs >= xs);
Especially the last two lines are very odd. No type should have that behavior.
Comment #3 by robert.schadek — 2024-12-07T13:37:18Z