Commit 8fef23a525

Andrew Kelley <andrew@ziglang.org>
2019-08-27 19:36:42
add regression test for bug fixed by lazy values
closes #1310
1 parent 35a374e
Changed files (2)
test
stage1
behavior
test/stage1/behavior/bugs/1310.zig
@@ -0,0 +1,24 @@
+const std = @import("std");
+const expect = std.testing.expect;
+
+pub const VM = ?[*]const struct_InvocationTable_;
+pub const struct_InvocationTable_ = extern struct {
+    GetVM: ?extern fn (?[*]VM) c_int,
+};
+
+pub const struct_VM_ = extern struct {
+    functions: ?[*]const struct_InvocationTable_,
+};
+
+//excised output from stdlib.h etc
+
+pub const InvocationTable_ = struct_InvocationTable_;
+pub const VM_ = struct_VM_;
+
+extern fn agent_callback(_vm: [*]VM, options: [*]u8) i32 {
+    return 11;
+}
+
+test "fixed" {
+    expect(agent_callback(undefined, undefined) == 11);
+}
test/stage1/behavior.zig
@@ -15,6 +15,7 @@ comptime {
     _ = @import("behavior/bugs/1111.zig");
     _ = @import("behavior/bugs/1120.zig");
     _ = @import("behavior/bugs/1277.zig");
+    _ = @import("behavior/bugs/1310.zig");
     _ = @import("behavior/bugs/1322.zig");
     _ = @import("behavior/bugs/1381.zig");
     _ = @import("behavior/bugs/1421.zig");