Files
zig/test/cases/compile_errors/dereference_slice.zig
Justus Klausecker e69d19d1ee Sema: allow direct dereference of comptime-known slices
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.
2026-08-02 14:41:10 +02:00

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