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

--- Comment #4 from [email protected] ---
(In reply to Kenji Hara from comment #2)
[...]
> It's intended behavior, because compiler cannot know whether the generated
> opEquals is what programmer is expecting.
[...]

That doesn't make sense. The programmer has already defined opCmp, which means
"a == b" is already compiled to be "a.opCmp(b)==0". Therefore, if the
programmer didn't define opEquals, it should simply default to:
----
bool opEquals(T b) { return a.opCmp(b)==0; }
----

By your logic, the compiler should reject "a == b" when the programmer hasn't
defined opEquals, because the compiler cannot know whether a.opCmp(b)==0 is
what the programmer is expecting. I don't understand how this could make any
sense.

--

Reply via email to