zig/test/cases/bugs/1277.zig

16 lines
269 B
Zig
Raw Normal View History

const std = @import("std");
const S = struct {
f: ?fn () i32,
};
const s = S{ .f = f };
fn f() i32 {
return 1234;
}
test "don't emit an LLVM global for a const function when it's in an optional in a struct" {
std.debug.assertOrPanic(s.f.?() == 1234);
}