# Sema: allow dereferencing ill-defined pointers to zero-bit types at comptime · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/4ec299007a6a183edddfcb0505a9c1501da7ad0c)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 4ec299007a6a183edddfcb0505a9c1501da7ad0c

Requested commit: 4ec299007a6a183edddfcb0505a9c1501da7ad0c

Commit: 4ec299007a6a183edddfcb0505a9c1501da7ad0c

Tree: 147976e4d469e4e494244bb86111b73aaeb7bd11

Author: mlugg

Committer: Andrew Kelley

## Message

```
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.

```

## Parents

- [68c7261e1daf7787dcbf0cd6f9b01e5678d20a93](https://git.cafe/gitcafe/zig/commit/68c7261e1daf7787dcbf0cd6f9b01e5678d20a93?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/4ec299007a6a183edddfcb0505a9c1501da7ad0c?format=markdown)
