aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-08-27 13:44:04 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-08-27 13:44:04 -0400
commite1b258f39fcb4fff97a4fcf6ee9db10bb71646cc (patch)
tree9f24414972de1eab0ef26053fe1784dace056d1d
parent8fef23a5250efc38b16b720f298a61d793ace4e3 (diff)
downloadzig-e1b258f39fcb4fff97a4fcf6ee9db10bb71646cc.tar.gz
zig-e1b258f39fcb4fff97a4fcf6ee9db10bb71646cc.zip
add regression test for bug fixed by lazy values
closes #624
-rw-r--r--test/stage1/behavior.zig1
-rw-r--r--test/stage1/behavior/bugs/624.zig23
2 files changed, 24 insertions, 0 deletions
diff --git a/test/stage1/behavior.zig b/test/stage1/behavior.zig
index 49cd077669..d35b467bd1 100644
--- a/test/stage1/behavior.zig
+++ b/test/stage1/behavior.zig
@@ -32,6 +32,7 @@ comptime {
_ = @import("behavior/bugs/394.zig");
_ = @import("behavior/bugs/421.zig");
_ = @import("behavior/bugs/529.zig");
+ _ = @import("behavior/bugs/624.zig");
_ = @import("behavior/bugs/655.zig");
_ = @import("behavior/bugs/656.zig");
_ = @import("behavior/bugs/679.zig");
diff --git a/test/stage1/behavior/bugs/624.zig b/test/stage1/behavior/bugs/624.zig
new file mode 100644
index 0000000000..1eee889a0d
--- /dev/null
+++ b/test/stage1/behavior/bugs/624.zig
@@ -0,0 +1,23 @@
+const std = @import("std");
+const expect = std.testing.expect;
+
+const TestContext = struct {
+ server_context: *ListenerContext,
+};
+
+const ListenerContext = struct {
+ context_alloc: *ContextAllocator,
+};
+
+const ContextAllocator = MemoryPool(TestContext);
+
+fn MemoryPool(comptime T: type) type {
+ return struct {
+ n: usize,
+ };
+}
+
+test "foo" {
+ var allocator = ContextAllocator{ .n = 10 };
+ expect(allocator.n == 10);
+}