mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-10-29 03:06:10 +08:00
A comptime-known `[]T` should behave as similarly as possible to a comptime- known `*[n]T`. It is now possible to directly dereference both to an array. Also adds checks for slices with undefined length in code paths where a slice is dereferenced as an array which would previously crash.
11 lines
154 B
Zig
11 lines
154 B
Zig
fn entry(x: []i32) i32 {
|
|
return x.*;
|
|
}
|
|
comptime {
|
|
_ = &entry;
|
|
}
|
|
|
|
// error
|
|
//
|
|
// :2:13: error: index syntax required to access runtime-known slice
|