zig icon indicating copy to clipboard operation
zig copied to clipboard

Adding `comptime` to a variable previously declared `var` when it's value is constant segfaults the compiler.

Open kprotty opened this issue 2 years ago • 0 comments

Zig Version

0.12.0-dev.64+b835fd90c

Steps to Reproduce and Observed Behavior

var flag: bool = false;
if (comptime flag) {}

Expected Behavior

This worked in the previous tagged release of 0.10.1, but not sure if it still should. The fix (and more obvious declaration) of comptime var flag works. The compiler probably shouldn't segfault, but instead return a compileError.

kprotty avatar Aug 11 '23 16:08 kprotty