http://d.puremagic.com/issues/show_bug.cgi?id=7733

           Summary: [tdpl] opIndexUnary not called with postfix
                    increment/decrement operators
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: hst...@quickfur.ath.cx


--- Comment #0 from hst...@quickfur.ath.cx 2012-03-19 10:56:39 PDT ---
struct S {
    int[] data;
    void opIndex(size_t i) { return data[i]; }
    void opIndexUnary(string op)(size_t i) {
        return mixin(op ~ "data[i]");
    }
}
void main() {
    S s;
    s.data = [1,2,3];
    ++s[0]; // OK
    s[0]++; // Error: s.opIndex(1u) is not an lvalue
}

This contradicts the specs, that specify that x++ is translated to ++x, which
should cause opIndexUnary!"++" to be called, not opIndex.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to