mirror of
https://github.com/ziglang/zig.git
synced 2026-01-03 20:13:21 +00:00
parent
cd1833044a
commit
1d0b729f28
@ -26139,11 +26139,12 @@ fn analyzeSlice(
|
||||
var array_ty = ptr_ptr_child_ty;
|
||||
var slice_ty = ptr_ptr_ty;
|
||||
var ptr_or_slice = ptr_ptr;
|
||||
var elem_ty = ptr_ptr_child_ty.childType();
|
||||
var elem_ty: Type = undefined;
|
||||
var ptr_sentinel: ?Value = null;
|
||||
switch (ptr_ptr_child_ty.zigTypeTag()) {
|
||||
.Array => {
|
||||
ptr_sentinel = ptr_ptr_child_ty.sentinel();
|
||||
elem_ty = ptr_ptr_child_ty.childType();
|
||||
},
|
||||
.Pointer => switch (ptr_ptr_child_ty.ptrSize()) {
|
||||
.One => {
|
||||
|
||||
9
test/cases/compile_errors/slice_of_non_array_type.zig
Normal file
9
test/cases/compile_errors/slice_of_non_array_type.zig
Normal file
@ -0,0 +1,9 @@
|
||||
comptime {
|
||||
_ = 1[0..];
|
||||
}
|
||||
|
||||
// error
|
||||
// backend=stage2
|
||||
// target=native
|
||||
//
|
||||
// :2:10: error: slice of non-array type 'comptime_int'
|
||||
Loading…
x
Reference in New Issue
Block a user