[Issue 655] Operator overload uses opIndex instead of opIndexAssign
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Dec 6 07:18:33 PST 2006
http://d.puremagic.com/issues/show_bug.cgi?id=655
------- Comment #2 from jarrett.billingsley at gmail.com 2006-12-06 09:18 -------
> import std.stdio;
>
> struct Moo {
> void opIndex(int i, int i2) {
> writefln("opIndex:", i, i2);
> }
> }
>
> int main(char[][] args) {
> Moo m = *new Moo();
> m[0, 42]; // uses opIndex , ok
> m[0] = 42; // uses opIndex instead of opAssign, not ok according to spec
>
> return 0;
> }
>
When I compile that snippet in 0.176, I get the error:
dtest.d(134): Error: operator [] assignment overload with opIndex(i, value)
deprecated, use opIndexAssign(value, i)
Is that what you mean? Or does it compile for you?
I think it's a vestige of some _very_ old operator overloading behavior, Walter
probably missed it.
--
More information about the Digitalmars-d-bugs
mailing list