On Friday, 30 December 2016 at 22:42:07 UTC, Steven Schveighoffer
wrote:
What is actually happening is that the D main function returns.
Then the D runtime tears down everything, including joining all
threads, running all module static dtors, terminating the GC,
etc.
Then it returns to the OS the exit code.
So it's likely somewhere in there that it's hanging.
-Steve
I've tried manually reducing the code to find the problem. This
is what I've got. I'm not sure how to reduce it further.
class Foo {
~this() {
S* next, current;
next = current = _foo;
while (next) {
next = current.next;
theAllocator.dispose(current);
}
}
void insert(Range)(Range range) {
foreach (e; range)
_foo = theAllocator.make!S(_foo);
}
S* _foo;
struct S { S* next; }
}
unittest {
auto list = new Foo();
list.insert([1, 2, 3, 4]);
}