mirror of
https://github.com/ziglang/zig.git
synced 2025-12-10 16:23:07 +00:00
17 lines
304 B
Zig
17 lines
304 B
Zig
const std = @import("std");
|
|
const builtin = @import("builtin");
|
|
|
|
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" {
|
|
try std.testing.expect(s.f.?() == 1234);
|
|
}
|