zig/doc/langref/test_comptime_pointers.zig

14 lines
222 B
Zig
Raw Normal View History

const expect = @import("std").testing.expect;
test "comptime pointers" {
comptime {
var x: i32 = 1;
const ptr = &x;
ptr.* += 1;
x += 1;
try expect(ptr.* == 3);
}
}
// test