Skip to content

Commit 711d971

Browse files
committed
free_list: Fix broken unittest
Fix compilation error (previously, silent dangling pointer and double-free).
1 parent 24050c5 commit 711d971

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

std/experimental/allocator/building_blocks/free_list.d

+3-2
Original file line numberDiff line numberDiff line change
@@ -790,8 +790,9 @@ struct ContiguousFreeList(ParentAllocator,
790790
import std.experimental.allocator.building_blocks.region : Region;
791791
import std.experimental.allocator.gc_allocator : GCAllocator;
792792
import std.typecons : Ternary;
793-
alias A = ContiguousFreeList!(Region!GCAllocator, 0, 64);
794-
auto a = A(Region!GCAllocator(1024 * 4), 1024);
793+
alias A = ContiguousFreeList!(Region!GCAllocator*, 0, 64);
794+
auto r = Region!GCAllocator(1024 * 4);
795+
auto a = A(&r, 1024);
795796

796797
assert((() nothrow @safe @nogc => a.empty)() == Ternary.yes);
797798

0 commit comments

Comments
 (0)