[Issue 4934] New: Cannot compile an overloaded operator returning by ref

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Sep 24 07:35:44 PDT 2010


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

           Summary: Cannot compile an overloaded operator returning by ref
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: samukha at voliacable.com


--- Comment #0 from Max Samukha <samukha at voliacable.com> 2010-09-24 07:35:00 PDT ---
struct QString
{
    ref QString opOpAssign(string op : "+")(ref QString s)
    {
        return this;        
    }
}

void main()
{
    QString s;
    s += s; // fails
    s.opOpAssign!("+")(s); // compiles 
}

test.d(12): Error: variable test.QString.op only parameters or foreach
declarations can be ref

Compiles if the return type is omitted or the operator is called explicitly.

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