Files
zig/test/cases/compile_errors/panic_has_source_location.zig
Andrew Kelley 7f4c0e010d update safety test cases to new panic API
although they would also pass simply reverted to master branch because
I made the deprecated API still work for now (to be removed after 0.14.0
is tagged)
2024-09-26 17:14:17 -07:00

18 lines
381 B
Zig

const std = @import("std");
export fn foo() void {
// This should appear in the reference trace
// (and definitely shouldn't crash due to an unneeded source location!)
@panic("oh no");
}
pub fn panic(_: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noreturn {
@compileError("panic");
}
// error
// backend=stage2
// target=native
//
// :10:5: error: panic