#zig build-obj {
--name test -fno-emit-bin
-Mroot=test.zig
#}

#write test.zig {
export fn entry1() void {
    const y: [:1]const u8 = &[_:2]u8{ 1, 2 };
    _ = y;
}
export fn entry2() void {
    const x: [:2]const u8 = &.{ 1, 2 };
    const y: [:1]const u8 = x;
    _ = y;
}
#}
#update
#check errors {
test.zig:2:29: error: expected type '[:1]const u8', found '*const [2:2]u8'
test.zig:2:29: note: pointer sentinel '2' cannot cast into pointer sentinel '1'
test.zig:7:29: error: expected type '[:1]const u8', found '[:2]const u8'
test.zig:7:29: note: pointer sentinel '2' cannot cast into pointer sentinel '1'
#}

#write test.zig {
fn foo() [:0]u8 {
    const x: []u8 = undefined;
    return x;
}
comptime {
    _ = &foo;
}
#}
#update
#check errors {
test.zig:3:12: error: expected type '[:0]u8', found '[]u8'
test.zig:3:12: note: destination pointer requires '0' sentinel
test.zig:1:10: note: function return type declared here
#}
