mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 12:59:04 +00:00
std.MultiArrayList: check size of element, not pointer
Ever since a semi-recent language specification update, pointers to zero-sized types still have runtime bits.
This commit is contained in:
parent
bb0e28a54f
commit
b802a67562
@ -42,7 +42,10 @@ pub fn MultiArrayList(comptime S: type) type {
|
||||
return &[_]F{};
|
||||
}
|
||||
const byte_ptr = self.ptrs[@enumToInt(field)];
|
||||
const casted_ptr: [*]F = if (@sizeOf([*]F) == 0) undefined else @ptrCast([*]F, @alignCast(@alignOf(F), byte_ptr));
|
||||
const casted_ptr: [*]F = if (@sizeOf(F) == 0)
|
||||
undefined
|
||||
else
|
||||
@ptrCast([*]F, @alignCast(@alignOf(F), byte_ptr));
|
||||
return casted_ptr[0..self.len];
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user