[Issue 5202] opIndexAssign doesn't work on structs obtained via getters

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 11 12:08:40 PST 2010


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


David Simcha <dsimcha at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid


--- Comment #1 from David Simcha <dsimcha at yahoo.com> 2010-11-11 12:07:32 PST ---
Argh, accidentally hit enter.  Please disregard the blank first post.

struct OpIndexAssign {
    void opIndexAssign(uint val, uint index) {}
    uint opIndex(uint index) { return 42; }
}

struct Struct {
    OpIndexAssign oas;

    OpIndexAssign getter() @property {
        return oas;
    }
}

void main() {
    Struct s;
    s.oas[5] = 5;  // Works
    s.getter[5] = 5;  // Fails
}


Error message:

test.d(17): Error: s.getter()[5u] is not an lvalue

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


More information about the Digitalmars-d-bugs mailing list