aboutsummaryrefslogtreecommitdiff
path: root/test/cases/safety/calling panic.zig
blob: d77104bbb39e6b6f0ab70138faee5c403a2953a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
const std = @import("std");

pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn {
    _ = stack_trace;
    if (std.mem.eql(u8, message, "oh no")) {
        std.process.exit(0);
    }
    std.process.exit(1);
}
pub fn main() !void {
    if (true) @panic("oh no");
    return error.TestFailed;
}
// run
// backend=selfhosted,llvm
// target=x86_64-linux,aarch64-linux