Sema: populate the sentinel for comptime array inits
This commit is contained in:
@@ -166,3 +166,16 @@ test "anonymous literal in array" {
|
||||
try S.doTheTest();
|
||||
comptime try S.doTheTest();
|
||||
}
|
||||
|
||||
test "access the null element of a null terminated array" {
|
||||
const S = struct {
|
||||
fn doTheTest() !void {
|
||||
var array: [4:0]u8 = .{ 'a', 'o', 'e', 'u' };
|
||||
try expect(array[4] == 0);
|
||||
var len: usize = 4;
|
||||
try expect(array[len] == 0);
|
||||
}
|
||||
};
|
||||
try S.doTheTest();
|
||||
comptime try S.doTheTest();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user