[Issue 7670] New: UFCS problem with @property and structs

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 8 05:00:08 PST 2012


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

           Summary: UFCS problem with @property and structs
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2012-03-08 05:00:11 PST ---
Modified from an example by Comrad in D.learn.


struct A {
    double x;
}
@property ref double y(ref A a) {
    return a.x;
}
void main() {
    A a1;
    a1.y() = 2.0; // OK
    a1.y = 2.0; // Error
}


DMD 2.059head gives:

test.d(10): Error: no property 'y' for type 'A', did you mean 'x'?

-- 
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