mirror of
https://github.com/ziglang/zig.git
synced 2026-01-10 01:15:14 +00:00
And fix test cases to make them pass. This is in preparation for starting to pass behavior tests with self-hosted.
16 lines
264 B
Zig
16 lines
264 B
Zig
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.testing.expect(s.f.?() == 1234);
|
|
}
|