authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-08-27 13:36:42-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-08-27 13:36:42-04:00
log8fef23a5250efc38b16b720f298a61d793ace4e3
tree9f53f4da38dc1f8ce513e9e6caca6f3ba15893d6
parent35a374efe034ae5ed9aafc06bbc581044e7325de
signaturelock-open Commit is signed but in an unrecognized format.

add regression test for bug fixed by lazy values

closes #1310

2 files changed, 25 insertions(+), 0 deletions(-)

test/stage1/behavior.zig+1
...@@ -15,6 +15,7 @@ comptime {...@@ -15,6 +15,7 @@ comptime {
15 _ = @import("behavior/bugs/1111.zig");15 _ = @import("behavior/bugs/1111.zig");
16 _ = @import("behavior/bugs/1120.zig");16 _ = @import("behavior/bugs/1120.zig");
17 _ = @import("behavior/bugs/1277.zig");17 _ = @import("behavior/bugs/1277.zig");
18 _ = @import("behavior/bugs/1310.zig");
18 _ = @import("behavior/bugs/1322.zig");19 _ = @import("behavior/bugs/1322.zig");
19 _ = @import("behavior/bugs/1381.zig");20 _ = @import("behavior/bugs/1381.zig");
20 _ = @import("behavior/bugs/1421.zig");21 _ = @import("behavior/bugs/1421.zig");
test/stage1/behavior/bugs/1310.zig created+24
...@@ -0,0 +1,24 @@
1const std = @import("std");
2const expect = std.testing.expect;
3
4pub const VM = ?[*]const struct_InvocationTable_;
5pub const struct_InvocationTable_ = extern struct {
6 GetVM: ?extern fn (?[*]VM) c_int,
7};
8
9pub const struct_VM_ = extern struct {
10 functions: ?[*]const struct_InvocationTable_,
11};
12
13//excised output from stdlib.h etc
14
15pub const InvocationTable_ = struct_InvocationTable_;
16pub const VM_ = struct_VM_;
17
18extern fn agent_callback(_vm: [*]VM, options: [*]u8) i32 {
19 return 11;
20}
21
22test "fixed" {
23 expect(agent_callback(undefined, undefined) == 11);
24}