Skip to content

@ptrFromInt(0) on ?*allowzero T gives null #21775

@xdBronch

Description

@xdBronch

Zig Version

0.14.0-dev.1951+857383689

Steps to Reproduce and Observed Behavior

comptime {
    @compileLog(@as(?*allowzero const u8, @ptrFromInt(0)));
}
Compile Log Output:
@as(?*allowzero const u8, null)

this feels very unexpected to me

Expected Behavior

pointer should be the same as @as(*allowzero const u8, @ptrFromInt(0))

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions