www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7032] New: OpAssign is not called when this(this) is disabled

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

           Summary: OpAssign is not called when this(this) is disabled
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: deadalnix gmail.com



As of
http://digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=150299

If we disable this(this) in a struct, the opAssign member function should be
used if it exists. Here is a sample code :

module fail2;

struct Fail {
     disable
    this(this);

    ref Fail opAssign(ref const Fail t) {
        return this;
    }
}

int main(string[] argv) {
    Fail a;
    Fail b = a; // Error: struct fail2.Fail is not copyable because it is
annotated with  disable

    return 0;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 29 2011