[Issue 22717] object.TypeInfo_Struct.equals swaps lhs and rhs parameters

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jan 31 11:23:36 UTC 2022


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

Iain Buclaw <ibuclaw at gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw at gdcproject.org

--- Comment #1 from Iain Buclaw <ibuclaw at gdcproject.org> ---
(In reply to Iain Buclaw from comment #0)
> If `opEquals(const ref)` was called properly by druntime, then the above
> quoted line should instead be: `(cast()ti).equalsx(cast()s.ti);`
As such, fixing this will result in a MAJOR BREAKING CHANGE, and the DMD
compiler implementation will require it's buggy `opEquals()` to be fixed using:

```
static if (__VERSION__ >= FIXED_VERSION)
    // druntime xopEquals called this function as lhs.opEquals(rhs)
    (cast()ti).equalsx(cast()s.ti);
else
    // druntime xopEquals called this function as rhs.opEquals(lhs)
    (cast()s.ti).equalsx(cast()ti);
```

--


More information about the Digitalmars-d-bugs mailing list