stage2: fix Decl addrspace being undefined

This commit is contained in:
Andrew Kelley
2021-10-22 15:53:59 -07:00
parent 069c83d58c
commit f0dcdd7931
4 changed files with 23 additions and 17 deletions

View File

@@ -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];