www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10428] New: Assignment operator returns by value (not by ref like you'd expect)

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

           Summary: Assignment operator returns by value (not by ref like
                    you'd expect)
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: tommitissari hotmail.com



Assignment operators should return by ref, not by value.

void edit(ref int) { }

void main()
{
    int n;
    edit(n += 4); // OK
    edit(n = 4); // [1]
}

---
1) Error: function main.edit (ref int _param_0) is not callable using argument
types (int)

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