aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/basic.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-10-22 15:53:59 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-10-22 15:53:59 -0700
commitf0dcdd7931f1eb4f3b6a0a87c914baf770f6df03 (patch)
tree2182e84263410cd093d51c5df6393848f3724b22 /test/behavior/basic.zig
parent069c83d58cebba88275ee76ba01fabcd8e964573 (diff)
downloadzig-f0dcdd7931f1eb4f3b6a0a87c914baf770f6df03.tar.gz
zig-f0dcdd7931f1eb4f3b6a0a87c914baf770f6df03.zip
stage2: fix Decl addrspace being undefined
Diffstat (limited to 'test/behavior/basic.zig')
-rw-r--r--test/behavior/basic.zig13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/behavior/basic.zig b/test/behavior/basic.zig
index ae4cb26354..f3d511916f 100644
--- a/test/behavior/basic.zig
+++ b/test/behavior/basic.zig
@@ -2,6 +2,7 @@ const std = @import("std");
const builtin = @import("builtin");
const mem = std.mem;
const expect = std.testing.expect;
+const expectEqualStrings = std.testing.expectEqualStrings;
// normal comment
@@ -446,3 +447,15 @@ test "self reference through fn ptr field" {
a.f = S.foo;
try expect(a.f(a) == 12);
}
+
+test "global variable initialized to global variable array element" {
+ try expect(global_ptr == &gdt[0]);
+}
+const GDTEntry = struct {
+ field: i32,
+};
+var gdt = [_]GDTEntry{
+ GDTEntry{ .field = 1 },
+ GDTEntry{ .field = 2 },
+};
+var global_ptr = &gdt[0];