mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
Merge 8fb0cedce3 into 9082b004b6
This commit is contained in:
commit
5840f5ca4e
1 changed files with 2 additions and 0 deletions
|
|
@ -608,6 +608,8 @@ pub fn testAllocator(base_allocator: mem.Allocator) !void {
|
|||
|
||||
// Zero-length allocation
|
||||
const empty = try allocator.alloc(u8, 0);
|
||||
try testing.expect(empty.len == 0);
|
||||
try testing.expect(empty.ptr == @as([*]u8, @ptrFromInt(std.math.maxInt(usize))));
|
||||
allocator.free(empty);
|
||||
// Allocation with zero-sized types
|
||||
const zero_bit_ptr = try allocator.create(u0);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue