[Issue 22159] "==" causeses error for array of classes in safe method

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 15 05:49:38 UTC 2023


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

Simon Naarmann <eiderdaus at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |eiderdaus at gmail.com

--- Comment #4 from Simon Naarmann <eiderdaus at gmail.com> ---
I just ran into this in 2.102.1. In my case, the error message was even more
eyebrow-raising:

    incompatible types for array comparison: `X[]` and `X[]`

This already helped me guess that the culprit was the @system Object.opEquals.

But the entire issue, regardless of `C[3]` or `X[]`, has newbie-confusing
potential. They follow best practices with @safe, compare arrays by the book,
and run into the error that they can't compare an array even with itself.

--


More information about the Digitalmars-d-bugs mailing list