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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 20 14:02:17 PDT 2013


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 at puremagic.com
        ReportedBy: tommitissari at hotmail.com


--- Comment #0 from Tommi <tommitissari at hotmail.com> 2013-06-20 14:02:16 PDT ---
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: -------


More information about the Digitalmars-d-bugs mailing list