https://issues.dlang.org/show_bug.cgi?id=22547
Issue ID: 22547 Summary: .dup on array of nested structs can cause null dereference if copy throws Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: druntime Assignee: nob...@puremagic.com Reporter: stanislav.bli...@gmail.com As pointed out by @kinke here: https://forum.dlang.org/post/yfiytdysalmauqadt...@forum.dlang.org void main() { int i; struct S { // A copy ctor won't currently compile (dmd 2.098) // due to "cannot access stack frame pointer..." this(this) { throw new Exception("!!!"); } ~this() { ++i; } } auto a1 = [ S() ]; auto a2 = a1.dup; // throws } // segmentation fault when destructing a2 because a2[0].tupleof[$-1] is null --