Unittest hangs on completion

David Zhang via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Dec 30 18:32:09 PST 2016


On Saturday, 31 December 2016 at 02:03:07 UTC, rikki cattermole 
wrote:
> As it should, current is never reassigned.
> You only need one var, next. Of course I didn't read the entire 
> thread chain so, I'm probably missing something.
>
> import std.experimental.allocator;
>
> void main() {
>         struct S { S* next; }
>         S* _foo;
>         foreach (e; 0 .. 10)
>                 _foo = theAllocator.make!S(_foo);
>         S* next;
>
>         next = _foo;
>         while(next !is null) {
>                 auto nextT = next.next;
>                 theAllocator.dispose(next);
>                 next = nextT;
>         }
> }

Thanks for your response. So next is never null, and thus there 
is an infinite loop, correct? If so, why does dub indicate that 
all tests are complete?


More information about the Digitalmars-d-learn mailing list