[Issue 23291] Members of arrays of shared classes cannot be compared
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Aug 11 01:27:51 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23291
Boris Carvajal <boris2.9 at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |boris2.9 at gmail.com
--- Comment #2 from Boris Carvajal <boris2.9 at gmail.com> ---
Same as issue 23140, it never worked!
```d
const(shared C) c = new shared C();
const(shared C)[] a = [c];
const(shared C)[] b = [c];
assert(a[0] == b[0]);
```
Also, you should put `override` in `opEquals` definition:
`override bool opEquals(const(shared(Object)) rhs) const shared`
Now the real problem is more clear, there is no shared compatible `opEquals` in
D runtime so you can't even override it with your own implementation.
A quick search shows it's already reported in issues 4857, 9670, 14509.
Sad that one of them is 12 years old.
--
More information about the Digitalmars-d-bugs
mailing list