Open
Description
Zig Version
0.15.0-dev.767+201c0f54a
Steps to Reproduce and Observed Output
//! repro.zig
comptime {
const x: u32 = 42;
const ptr: *u32 = @constCast(&x);
ptr.* = 10;
}
$ zig build-obj repro.zig
repro.zig:5:11: error: unable to evaluate comptime expression
ptr.* = 10;
~~~~~~^~~~
repro.zig:5:8: note: operation is runtime due to this operand
ptr.* = 10;
~~~^~
repro.zig:2:1: note: 'comptime' keyword forces comptime evaluation
comptime {
^~~~~~~~
Expected Output
Something like this:
repro.zig:5:11: error: cannot store to constant memory
ptr.* = 10;
~~~~~~^~~~