diff options
Diffstat (limited to 'test/stage1/behavior')
| -rw-r--r-- | test/stage1/behavior/pointers.zig | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/stage1/behavior/pointers.zig b/test/stage1/behavior/pointers.zig index fdaa5867d7..bcc1d62df3 100644 --- a/test/stage1/behavior/pointers.zig +++ b/test/stage1/behavior/pointers.zig @@ -318,3 +318,15 @@ test "pointer arithmetic affects the alignment" { expect(@typeInfo(@TypeOf(ptr4)).Pointer.alignment == 4); } } + +test "@ptrToInt on null optional at comptime" { + { + const pointer = @intToPtr(?*u8, 0x000); + const x = @ptrToInt(pointer); + comptime expect(0 == @ptrToInt(pointer)); + } + { + const pointer = @intToPtr(?*u8, 0xf00); + comptime expect(0xf00 == @ptrToInt(pointer)); + } +} |
