[Issue 13179] AA key type TagIndex now requires equality rather than comparison
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Jul 23 10:02:54 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13179
Jonathan M Davis <jmdavisProg at gmx.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jmdavisProg at gmx.com
--- Comment #9 from Jonathan M Davis <jmdavisProg at gmx.com> ---
I would not expect `a == b` to _ever_ be converted to `a.opCmp(b) == 0`. That's
what opEquals is for. However, I also wouldn't expect declaring opCmp to make
it so that the compiler no longer generates an opEquals for the struct. The
compiler should either continue to declare the opEquals or make it an error if
you define opCmp but not opEquals. It makes no sense whatsoever to have a type
which is comparable with <, <=, >=, and > but not ==. And it should _always_ be
considered a bug if `a.opCmp(b) == 0` is not equivalent to `a == b` or if `a <=
b && a >= b` is not equivalent to `a == b`.
--
More information about the Digitalmars-d-bugs
mailing list