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:
@@ -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];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user