Files
zig/test/cases/safety/@enumFromInt truncated bits - exhaustive.zig
T
Mason Remaley ac207073f3 Reverts renaming of builtin.StackTrace -> ErrorReturnTrace
We can defer this change until the next time zig1 needs to be updated
2026-04-12 04:01:30 -07:00

24 lines
483 B
Zig

const std = @import("std");
pub fn panic(message: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noreturn {
if (std.mem.eql(u8, message, "invalid enum value")) {
std.process.exit(0);
}
std.process.exit(1);
}
pub fn main() u8 {
var num: i5 = undefined;
num = 14;
const E = enum(u3) { a, b, c, d, e, f, g, h };
const invalid: E = @enumFromInt(num);
_ = invalid;
return 1;
}
// run
// backend=selfhosted,llvm
// target=x86_64-linux