mirror of
https://codeberg.org/ziglang/zig
synced 2026-11-18 07:05:05 +00:00
When we want a runtime pointer to a zero-bit value we use an undef pointer, but what if we want a runtime pointer to a comptime-only value? Normally, if `T` is a comptime-only type such as `*const comptime_int`, then `*const T` would also be a comptime-only type, so anything referencing a comptime-only value is usually also comptime-only, and therefore not emitted to the executable. However, what if instead we have a `*const anyopaque` pointing to a comptime-only value? Certainly, `*const anyopaque` is a runtime type, and so we need some runtime value to store, even when it happens to be pointing to a comptime-only value. In this case we want to do the same thing as we do when pointing to a zero-bit value, so we use `hasRuntimeBits` to handle both cases instead of ignoring comptime. Closes #12025 |
History
|
|
|---|---|---|
| .. | ||
| behavior | ||
| c_abi | ||
| cases | ||
| link | ||
| src | ||
| stage2 | ||
| standalone | ||
| assemble_and_link.zig | ||
| behavior.zig | ||
| cases.zig | ||
| cli.zig | ||
| compare_output.zig | ||
| compile_errors.zig | ||
| gen_h.zig | ||
| link.zig | ||
| run_translated_c.zig | ||
| stack_traces.zig | ||
| standalone.zig | ||
| tests.zig | ||
| translate_c.zig | ||