zig/test/cases/compile_errors/non_scalar_sentinel.zig
Ali Cheraghi dec1163fbb
all: replace all @Type usages
Co-authored-by: Matthew Lugg <mlugg@mlugg.co.uk>
2025-11-22 22:42:38 +00:00

32 lines
719 B
Zig

const S = struct {};
const sentinel: S = .{};
comptime {
_ = [0:sentinel]S;
}
comptime {
_ = [:sentinel]S;
}
comptime {
_ = [*:sentinel]S;
}
comptime {
_ = @Pointer(.slice, .{}, S, sentinel);
}
comptime {
_ = @Pointer(.many, .{}, S, sentinel);
}
// error
//
// :5:12: error: non-scalar sentinel type 'tmp.S'
// :1:11: note: struct declared here
// :8:11: error: non-scalar sentinel type 'tmp.S'
// :1:11: note: struct declared here
// :11:12: error: non-scalar sentinel type 'tmp.S'
// :1:11: note: struct declared here
// :15:34: error: non-scalar sentinel type 'tmp.S'
// :1:11: note: struct declared here
// :18:33: error: non-scalar sentinel type 'tmp.S'
// :1:11: note: struct declared here