[Issue 9335] Dtors are not called for dynamic arrays initialized by literals

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 28 06:04:09 PDT 2013


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



--- Comment #6 from yebblies <yebblies at gmail.com> 2013-06-28 23:04:08 EST ---
(In reply to comment #5)
> Stop. Why GC collects it?
> Destructor should be called when declaration scope ends.
> This is array of structs, not of classes.

void main()
{
    S[] arr = [S()];
}

This is an array of structs, and the array is on the heap.

This would be an array on the stack:

void main()
{
    S[1] arr = [S()];
}

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