zig/doc/langref/test_intCast_builtin.zig

9 lines
161 B
Zig
Raw Normal View History

test "integer cast panic" {
var a: u16 = 0xabcd; // runtime-known
_ = &a;
const b: u8 = @intCast(a);
_ = b;
}
// test_error=cast truncated bits