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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 17 08:34:25 PST 2013


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

           Summary: Dtors are not called for dynamic arrays initialized by
                    literals
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: maxim at maxim-fomin.ru


--- Comment #0 from Maxim Fomin <maxim at maxim-fomin.ru> 2013-01-17 08:34:20 PST ---
Dynamic arrays of structs initialized by array literals go out of scope without
calling destructors. This does not happen with static arrays.

import std.stdio : writefln;

struct S
{
    int i;
    this(this) { writefln("%X postbit", i); i = 0;}
    ~this() { writefln("%X dtor", i); }
}

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

Issue is maked as dmd issue, because druntime cannot call destructors when AA
array goes out of the scope.

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