Cases where it is required are limited, but one example is BigInt.
int x = 14;
BigInt y = 3;
x = x / y; // OK.
x /= y; // No way to support this
Applies to /= and %=.
Comment #1 by witold.baryluk+d — 2010-10-31T05:57:50Z
I would also like this feature.
One of the reason this is not supported, is that in fact
int x = 14;
BigInt y = 3;
x = x/y;
is, actually x = cast(int)(x/y);
And there is no way to change type in opAssign (old opXXXAssign).
Comment #2 by robert.schadek — 2024-12-13T17:53:26Z