-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
acceptedThis proposal is planned.This proposal is planned.proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.This issue suggests modifications. If it also has the "accepted" label then it is planned.
Milestone
Description
The following code currently compiles without errors:
const std = @import("std");
const assert = std.debug.assert;
test {
var foo: [*]const u8 = &.{ 1, 2 };
_ = foo[0.. :0];
comptime assert(@TypeOf(foo[0.. :0]) == [*]const u8);
}The sentinel expression is being analyzed but has does nothing.
I can think of two possible ways to resolve this:
- disallow
ptr[start.. :sentinel]on a multi item pointer (or C pointer) - resolve to
[*:0]const u8
The problem with the second option is that it is not possible to implement a safety check for it.
Related:
Metadata
Metadata
Assignees
Labels
acceptedThis proposal is planned.This proposal is planned.proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.This issue suggests modifications. If it also has the "accepted" label then it is planned.