https://dlang.org/spec/type.html#usual-arithmetic-conversions
This defines a series of possible conversions used to bring two expressions to the same type for arithmetic operations. This set of conversions is mentioned for equality expressions, among others. However, the spec doesn't mention what happens when those conversions fail. I guess it's undefined behavior?
Comment #1 by dhasenan — 2019-01-30T01:19:10Z
The specific manifestation of this is with identity expressions on unrelated interfaces:
---
interface A {}
interface B {}
class C : A, B {}
void main()
{
A a = new C;
B b = new C;
assert(a !is b);
}
---
The spec doesn't say whether this should work. The Usual Arithmetic Conversions fail. It doesn't say that anything in particular should happen in this case, but it vaguely implies that they need to succeed.
Comment #2 by robert.schadek — 2024-12-13T19:02:16Z