| 1 | const std = @import("std"); |
| 2 | |
| 3 | pub fn panic(message: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noreturn { |
| 4 | if (std.mem.eql(u8, message, "invalid enum value")) { |
| 5 | std.process.exit(0); |
| 6 | } |
| 7 | std.process.exit(1); |
| 8 | } |
| 9 | |
| 10 | pub fn main() u8 { |
| 11 | var num: i5 = undefined; |
| 12 | num = 14; |
| 13 | |
| 14 | const E = enum(u3) { a, b, c, d, e, f, g, h }; |
| 15 | const invalid: E = @enumFromInt(num); |
| 16 | _ = invalid; |
| 17 | |
| 18 | return 1; |
| 19 | } |
| 20 | |
| 21 | // run |
| 22 | // backend=selfhosted,llvm |
| 23 | // target=x86_64-linux,wasm32-wasi |