zig/test/behavior/bugs/3112.zig
2022-12-10 21:51:46 +07:00

22 lines
615 B
Zig

const builtin = @import("builtin");
const std = @import("std");
const expect = std.testing.expect;
const State = struct {
const Self = @This();
enter: *const fn (previous: ?Self) void,
};
fn prev(p: ?State) void {
expect(p == null) catch @panic("test failure");
}
test "zig test crash" {
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
var global: State = undefined;
global.enter = prev;
global.enter(null);
}