zig/test/cases/compile_errors/invalid_pointer_cast.zig
mlugg 5322459a0b Sema: fix UB in error reporting
And add test coverage for the compile error in question.
2025-01-14 21:17:46 +00:00

11 lines
280 B
Zig

export fn foo() void {
const slice: []const u8 = &.{ 1, 2, 3 };
const result: [*]const u8 = @alignCast(slice);
_ = result;
}
// error
//
// :3:33: error: cannot implicitly convert slice to many pointer
// :3:33: note: use 'ptr' field to convert slice to many pointer