behavior: correct alignment for elements and slices of aligned array
Closes #11751
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user