Zig Version
0.14.0-dev.2634+b36ea592b
Steps to Reproduce and Observed Behavior
const std = @import("std");
fn maybeError(x: u32) !u32 {
return if (x % 2 == 0) error.Error else x;
}
export fn main() noreturn {
const x = maybeError(5) catch panic();
std.debug.print("{}\n", .{x});
while (true) {}
}
pub fn panic() noreturn {
while (true) {}
}
zig build-obj main.zig has the following output
thread 19206 panic: parameter count mismatch calling builtin fn, expected 0, found 3
Unable to dump stack trace: debug info stripped
fish: Job 1, 'nix run 'github:mitchellh/zig-o…' terminated by signal SIGABRT (Abort)
Expected Behavior
0.13.0 prints an error and doesn't crash:
/nix/store/s3nq31mhm8gxkq691p5w6q61ficw1hvr-zig-0.13.0/lib/std/builtin.zig:751:9: error: expected type 'fn ([]const u8, ?*builtin.StackTrace, ?usize) noreturn', found 'fn () noreturn'
root.panic
~~~~^~~~~~
/nix/store/s3nq31mhm8gxkq691p5w6q61ficw1hvr-zig-0.13.0/lib/std/builtin.zig:751:9: note: function with 0 parameters cannot cast into a function with 3 parameters
Zig Version
0.14.0-dev.2634+b36ea592b
Steps to Reproduce and Observed Behavior
zig build-obj main.zighas the following outputExpected Behavior
0.13.0 prints an error and doesn't crash: