[Issue 9989] destructor triggers creation of opAssign for structs

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Apr 26 01:36:21 PDT 2013


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



--- Comment #3 from Kenji Hara <k.hara.pg at gmail.com> 2013-04-26 01:36:20 PDT ---
(In reply to comment #2)
> 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();

OK. it is sane behavior, and my fix was not correct.
But, if so, current dmd generates wrong code for struct S.

I filed new issue for the problem.
Issue 9994 - Built-in generated opAssign should call dtor on assignment

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