zig/test/cases/bugs/1277.zig
Jimmi Holst Christensen 8139c5a516
New Zig formal grammar (#1685)
Reverted #1628 and changed the grammar+parser of the language to not allow certain expr where types are expected
2018-11-13 05:08:37 -08:00

16 lines
269 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.debug.assertOrPanic(s.f.?() == 1234);
}