[Issue 3511] New: ref return property confused with property setter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 14 12:56:10 PST 2009


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: nobody at puremagic.com
        ReportedBy: k-foley at onu.edu


--- Comment #0 from Kyle Foley <k-foley at 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: -------


More information about the Digitalmars-d-bugs mailing list