https://issues.dlang.org/show_bug.cgi?id=15582

          Issue ID: 15582
           Summary: Slice returned by opSlice() not accepted as lvalue
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: [email protected]
          Reporter: [email protected]

I believe this should work:

struct S {
    int[10] data;
    auto opSlice() { return data[]; }
}

void main() {
    S s;
    s[] = 10;   // Error: s[] is not an lvalue
    s[][] = 10; // works
}

--

Reply via email to