[Issue 9989] destructor triggers creation of opAssign for structs

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Apr 26 00:50:16 PDT 2013


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


Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla at digitalmars.com
         Resolution|                            |INVALID


--- Comment #2 from Walter Bright <bugzilla at digitalmars.com> 2013-04-26 00:50:15 PDT ---
The reason an opAssign is generated if a destructor is present is because
assignment can no longer just copy over the data. The destructor must be run,
and the generated opAssign ensures that. The generated opAssign looks like:

  S tmp = this;   // bit copy
  this = s;       // bit copy
  tmp.dtor();

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