mirror of
https://github.com/ziglang/zig.git
synced 2026-02-14 05:20:34 +00:00
This is all of the expected 0.14.0 progress on #21530, which can now be postponed once this commit is merged. This required rewriting the (un)wrap operations since the original implementations were extremely buggy. Also adds an easy way to retrigger Sema OPV bugs so that I don't have to keep updating #22419 all the time.
24 lines
473 B
Zig
24 lines
473 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=stage2,llvm
|
|
// target=native
|