mirror of
https://github.com/ziglang/zig.git
synced 2025-12-30 10:03:21 +00:00
12 lines
260 B
Zig
12 lines
260 B
Zig
const std = @import("std");
|
|
const expect = std.testing.expect;
|
|
|
|
const ptr = &global;
|
|
var global: usize = 123;
|
|
|
|
test "constant pointer to global variable causes runtime load" {
|
|
global = 1234;
|
|
try expect(&global == ptr);
|
|
try expect(ptr.* == 1234);
|
|
}
|