www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4934] New: Cannot compile an overloaded operator returning by ref

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: samukha voliacable.com



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: -------
Sep 24 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4934


Shin Fujishiro <rsinfu gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |rsinfu gmail.com
         Resolution|                            |DUPLICATE



---
*** This issue has been marked as a duplicate of issue 4041 ***

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