zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit abe672956ed037077b23ac6aa29df3dd99795539 (tree)
parent bf1d83482b581e49499e545cc625155c1043ef0c
Author: pfg <pfg@pfg.pw>
Date:   Thu,  3 Sep 2020 16:33:47 -0700

Test 0 bit allocation
Diffstat:
Mlib/std/heap.zig | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/lib/std/heap.zig b/lib/std/heap.zig @@ -915,6 +915,10 @@ pub fn testAllocator(base_allocator: *mem.Allocator) !void { testing.expect(slice.len == 10); allocator.free(slice); + + const zero_bit_ptr = try allocator.create(u0); + zero_bit_ptr.* = 0; + allocator.destroy(zero_bit_ptr); } pub fn testAllocatorAligned(base_allocator: *mem.Allocator, comptime alignment: u29) !void {