From f0dcdd7931f1eb4f3b6a0a87c914baf770f6df03 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 22 Oct 2021 15:53:59 -0700 Subject: stage2: fix Decl addrspace being undefined --- test/behavior/basic.zig | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/behavior/basic.zig') 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]; -- cgit v1.2.3