mirror of
https://github.com/ziglang/zig.git
synced 2026-01-20 22:35:24 +00:00
behavior: correct alignment for elements and slices of aligned array
Closes #11751
This commit is contained in:
parent
c040c0f45a
commit
413a86f7eb
@ -37,3 +37,12 @@ test "comparison of @alignOf(T) against zero" {
|
||||
try expect(@alignOf(T) >= 0);
|
||||
}
|
||||
}
|
||||
|
||||
test "correct alignment for elements and slices of aligned array" {
|
||||
var buf: [1024]u8 align(64) = undefined;
|
||||
var start: usize = 1;
|
||||
var end: usize = undefined;
|
||||
try expect(@alignOf(@TypeOf(buf[start..end])) == @alignOf(*u8));
|
||||
try expect(@alignOf(@TypeOf(&buf[start..end])) == @alignOf(*u8));
|
||||
try expect(@alignOf(@TypeOf(&buf[start])) == @alignOf(*u8));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user