mirror of
https://github.com/ziglang/zig.git
synced 2026-02-16 14:28:57 +00:00
Sema: pass calculated offset to elemPtrType in elemPtrSlice
This commit is contained in:
parent
541b3e3a31
commit
540130650f
@ -22692,7 +22692,7 @@ fn elemPtrSlice(
|
||||
break :o index;
|
||||
} else null;
|
||||
|
||||
const elem_ptr_ty = try sema.elemPtrType(slice_ty, null);
|
||||
const elem_ptr_ty = try sema.elemPtrType(slice_ty, offset);
|
||||
|
||||
if (maybe_undef_slice_val) |slice_val| {
|
||||
if (slice_val.isUndef()) {
|
||||
|
||||
@ -564,3 +564,8 @@ test "@alignCast null" {
|
||||
const aligned: ?*anyopaque = @alignCast(@alignOf(?*anyopaque), ptr);
|
||||
try expect(aligned == null);
|
||||
}
|
||||
|
||||
test "alignment of slice element" {
|
||||
const a: []align(1024) const u8 = undefined;
|
||||
try expect(@TypeOf(&a[0]) == *align(1024) const u8);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user