commit 8fef23a5250efc38b16b720f298a61d793ace4e3 (tree)
parent 35a374efe034ae5ed9aafc06bbc581044e7325de
Author: Andrew Kelley <andrew@ziglang.org>
Date: Tue, 27 Aug 2019 13:36:42 -0400
add regression test for bug fixed by lazy values
closes #1310
Diffstat:
2 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/test/stage1/behavior.zig b/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");
diff --git a/test/stage1/behavior/bugs/1310.zig b/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);
+}