# compiler: ensure local \`const\`s in comptime scope are comptime-known · gitcafe/zig

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

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

Visibility: public

Requested revision: 9a70eeeac52f1526b9df45614b86912565e53e54

Requested commit: 9a70eeeac52f1526b9df45614b86912565e53e54

Commit: 9a70eeeac52f1526b9df45614b86912565e53e54

Tree: 9509465bcd10becdf6dff9b49a3682235df246f5

Author: mlugg

Committer: mlugg

## Message

```
compiler: ensure local `const`s in comptime scope are comptime-known

This fixes a bug which exposed a compiler implementation detail (ZIR
alloc elision). Previously, `const` declarations with a runtime-known
value in a comptime scope were permitted only if AstGen was able to
elide the alloc in ZIR, since the error was reported by storing to the
comptime alloc.

This just adds a new instruction to also emit this error when the alloc
is elided.

```

## Parents

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

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