[Issue 14134] Free of large array does not work

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Feb 6 11:04:31 PST 2015


https://issues.dlang.org/show_bug.cgi?id=14134

--- Comment #5 from Rainer Schuetze <r.sagitario at gmx.de> ---
Maybe we should relax the restriction on base pointers for free().

What should happen with code like this?

   struct S { ~this() { printf("~this\n"); } int x; }

   S[] arr = new S[1000];
   S[] slice = arr[100..200];
   S[] tail = arr[200..1000];
   delete slice;

Should it call call only 100 destructors? All 1000? Is this invalid code?

Calling dtors twice could be fixed by explicitely removing the FINALIZE
attribute from the block, but could not work for just a part of the array.

--


More information about the Digitalmars-d-bugs mailing list