[Issue 655] New: Operator overload uses opIndex instead of opIndexAssign

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Dec 6 06:42:00 PST 2006


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 at digitalmars.com
        ReportedBy: brunodomedeiros+bugz at 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;
}


-- 




More information about the Digitalmars-d-bugs mailing list