mirror of
https://github.com/ziglang/zig.git
synced 2024-11-30 00:52:52 +00:00
12 lines
297 B
Zig
12 lines
297 B
Zig
const std = @import("std");
|
|
const expect = std.testing.expect;
|
|
|
|
test "allowzero" {
|
|
var zero: usize = 0; // var to make to runtime-known
|
|
_ = &zero; // suppress 'var is never mutated' error
|
|
const ptr: *allowzero i32 = @ptrFromInt(zero);
|
|
try expect(@intFromPtr(ptr) == 0);
|
|
}
|
|
|
|
// test
|