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

           Summary: ref return property confused with property setter
           Product: D
           Version: 2.036
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: k-fo...@onu.edu


--- Comment #0 from Kyle Foley <k-fo...@onu.edu> 2009-11-14 12:56:09 PST ---
import std.stdio;

struct A
{
    private int _prop = 42;

    ref int property() { return _prop; }
    //void property(in int rhs) { _prop = rhs; }
}

int main(string[] args)
{
    A a;

    writeln( a.property );

    a.property = 23; // produces the error below
    /*
    Error: function refProperty.A.property () is not callable using
           argument types (int)
    Error: expected 0 arguments, not 1 for non-variadic function type
           ref int()
    */

    writeln( a.property );

    return 0;
}

---

I think this is a bug, but it may actually be a "feature".

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

Reply via email to