[Issue 21983] dup leaves a partially constructed array if postblit/copy ctor throws
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri May 28 15:22:51 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=21983
--- Comment #1 from moonlightsentinel at disroot.org ---
Test case (run with current master):
import core.stdc.stdio : puts, printf;
struct S {
private int id;
this(this)
{
if (id == 2)
throw new Exception("");
}
~this()
{
printf("Destroying %d at %p\n", id, &this);
}
}
void main()
{
try
{
S[3] arr = [ S(1), S(2), S(3) ];
arr.dup();
}
catch (Exception e) {}
puts("Done");
}
====
Destroying 3 at 0x7fffcd3f3888
Destroying 2 at 0x7fffcd3f3884
Destroying 1 at 0x7fffcd3f3880
Done
Destroying -968732576 at 0x7fea0ce90008
Destroying 2 at 0x7fea0ce90004
Destroying 1 at 0x7fea0ce90000
--
More information about the Digitalmars-d-bugs
mailing list