master
 1#target=x86_64-linux-selfhosted
 2#target=x86_64-windows-selfhosted
 3#target=x86_64-linux-cbe
 4#target=x86_64-windows-cbe
 5#target=wasm32-wasi-selfhosted
 6#update=initial version
 7#file=main.zig
 8pub fn main() void {}
 9comptime {
10    var array = [_:0]u8{ 1, 2, 3, 4 };
11    const src_slice: [:0]u8 = &array;
12    const slice = src_slice[2..6];
13    _ = slice;
14}
15comptime {
16    var array = [_:0]u8{ 1, 2, 3, 4 };
17    const slice = array[2..6];
18    _ = slice;
19}
20comptime {
21    var array = [_]u8{ 1, 2, 3, 4 };
22    const slice = array[2..5];
23    _ = slice;
24}
25comptime {
26    var array = [_:0]u8{ 1, 2, 3, 4 };
27    const slice = array[3..2];
28    _ = slice;
29}
30#expect_error=main.zig:5:32: error: end index 6 out of bounds for slice of length 4 +1 (sentinel)
31#expect_error=main.zig:10:28: error: end index 6 out of bounds for array of length 4 +1 (sentinel)
32#expect_error=main.zig:15:28: error: end index 5 out of bounds for array of length 4
33#expect_error=main.zig:20:25: error: start index 3 is larger than end index 2
34
35#update=delete and modify comptime decls
36#file=main.zig
37pub fn main() void {}
38comptime {
39    const x: [*c]u8 = null;
40    var runtime_len: usize = undefined;
41    runtime_len = 0;
42    const y = x[0..runtime_len];
43    _ = y;
44}
45#expect_error=main.zig:6:16: error: slice of null pointer