zig icon indicating copy to clipboard operation
zig copied to clipboard

Sema: allow dereferencing ill-defined pointers to zero-bit types at comptime

Open mlugg opened this issue 2 years ago • 0 comments

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.

mlugg avatar Mar 16 '23 17:03 mlugg