aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/bugs/1486.zig
blob: 66414025e3310fb781952f287432271b0dc341a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
const std = @import("std");
const expect = std.testing.expect;
const builtin = @import("builtin");

const ptr = &global;
var global: usize = 123;

test "constant pointer to global variable causes runtime load" {
    if (builtin.zig_backend == .stage2_aarch64 and builtin.os.tag == .macos) return error.SkipZigTest;
    global = 1234;
    try expect(&global == ptr);
    try expect(ptr.* == 1234);
}