zig/test/cases/bugs/1277.zig
Jimmi Holst Christensen 378d3e4403
Solve the return type ambiguity (#1628)
Changed container and initializer syntax
* <container> { ... } -> <container> . { ... }
* <exrp> { ... } -> <expr> . { ...}
2018-10-15 09:51:15 -04:00

16 lines
270 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);
}