Skip to content

Commit 00201dd

Browse files
CyberShadow0xEAB
authored andcommitted
free_list: Fix broken unittest
Fix compilation error (previously, silent dangling pointer and double-free).
1 parent 91434fc commit 00201dd

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
@@ -814,8 +814,9 @@ struct ContiguousFreeList(ParentAllocator,
814814
import std.experimental.allocator.building_blocks.region : Region;
815815
import std.experimental.allocator.gc_allocator : GCAllocator;
816816
import std.typecons : Ternary;
817-
alias A = ContiguousFreeList!(Region!GCAllocator, 0, 64);
818-
auto a = A(Region!GCAllocator(1024 * 4), 1024);
817+
alias A = ContiguousFreeList!(Region!GCAllocator*, 0, 64);
818+
auto r = Region!GCAllocator(1024 * 4);
819+
auto a = A(&r, 1024);
819820

820821
assert((() nothrow @safe @nogc => a.empty)() == Ternary.yes);
821822

0 commit comments

Comments
 (0)