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

--- Comment #0 from 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; = [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:
------- You are receiving this mail because: -------

Reply via email to