zig/test/cases/comptime_var.1.zig

14 lines
260 B
Zig
Raw Normal View History

pub fn main() void {
var a: u32 = 0;
comptime var b: u32 = 0;
switch (a) {
0 => {},
else => b = 3,
}
}
// error
//
// :6:19: error: store to comptime variable depends on runtime condition
// :4:13: note: runtime condition here