zig
zig copied to clipboard
Sema: allow dereferencing ill-defined pointers to zero-bit types at comptime
It doesn't matter if a pointer to a zero-bit (i.e. OPV) type is undefined or runtime-known; we still know the result of the dereference at comptime. Code may use this, for instance, when allocating zero-bit types: @as(*void, undefined) is entirely reasonable to use at runtime, since we know the pointer will never be accessed, thus it should be valid at comptime too.