[Issue 9334] Dtor and postblit for struct heap object are not always called

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 7 10:29:21 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=9334


Denis Shelomovskij <verylonglogin.reg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |verylonglogin.reg at gmail.com


--- Comment #3 from Denis Shelomovskij <verylonglogin.reg at gmail.com> 2013-11-07 21:29:18 MSK ---
(In reply to comment #2)
> Note, this is not about optimizing, because 
> 
> auto foo()
> {
>     S* s = new S(1); 
> }
> 
> have no reason to create a temporary struct and than call destructor on it.

Think deeper. Unlike C++, you can't initialize structs in D like this: `S
s(...);`. And it isn't documented that `S s = S(...);` will not create
temporaries. See Issue 9002.

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


More information about the Digitalmars-d-bugs mailing list