[Issue 2889] New: Alias this properties don't overload with non-alias this properties.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Apr 24 13:55:53 PDT 2009


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

           Summary: Alias this properties don't overload with non-alias this
                    properties.
           Product: D
           Version: 2.029
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: dsimcha at yahoo.com


struct ArrayWrapper {
    uint[] arr;

    alias arr this;

    void length(uint l) {};
}

void main() {
    ArrayWrapper aw;
    auto len = aw.length;
}

Errors:
C:\home\dsimcha\bin\test.d(10): Error: function test.ArrayWrapper.length (uint
l) does not match parameter types ()
C:\home\dsimcha\bin\test.d(10): Error: expected 1 function arguments, not 0
C:\home\dsimcha\bin\test.d(10): Error: variable test.main.len voids have no
value
C:\home\dsimcha\bin\test.d(10): Error: expression aw.length() is void and has
no value

If I comment out the length property in the ArrayWrapper struct, length gets
forwarded properly to arr and the code compiles.


-- 



More information about the Digitalmars-d-bugs mailing list