Files
zig/test/cases/compile_errors/non-const_switch_number_literal.zig
2022-06-30 09:57:38 +02:00

19 lines
346 B
Zig

export fn foo() void {
const x = switch (bar()) {
1, 2 => 1,
3, 4 => 2,
else => 3,
};
_ = x;
}
fn bar() i32 {
return 2;
}
// error
// backend=stage2
// target=native
//
// :2:15: error: value with comptime only type 'comptime_int' depends on runtime control flow
// :2:26: note: runtime control flow here