digitalmars.D.bugs - [Issue 655] New: Operator overload uses opIndex instead of opIndexAssign
- d-bugmail puremagic.com (29/29) Dec 06 2006 http://d.puremagic.com/issues/show_bug.cgi?id=655
- d-bugmail puremagic.com (5/5) Dec 06 2006 http://d.puremagic.com/issues/show_bug.cgi?id=655
- d-bugmail puremagic.com (9/25) Dec 06 2006 When I compile that snippet in 0.176, I get the error:
- d-bugmail puremagic.com (9/9) Dec 07 2006 http://d.puremagic.com/issues/show_bug.cgi?id=655
http://d.puremagic.com/issues/show_bug.cgi?id=655 Summary: Operator overload uses opIndex instead of opIndexAssign Product: D Version: 0.176 Platform: PC OS/Version: Windows Status: NEW Keywords: accepts-invalid Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: brunodomedeiros+bugz gmail.com In an array assignment expression, operator overload uses opIndex instead of opIndexAssign. ---------- 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; } --
Dec 06 2006
http://d.puremagic.com/issues/show_bug.cgi?id=655 Agh, read the comment above as: m[0] = 42; // uses opIndex instead of opIndexAssign, not ok according to spec --
Dec 06 2006
http://d.puremagic.com/issues/show_bug.cgi?id=655import 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. --
Dec 06 2006
http://d.puremagic.com/issues/show_bug.cgi?id=655 brunodomedeiros+bugz gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID My mistake, I was compiling with -d (allow deprecated) and didn't notice it. --
Dec 07 2006