aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/unreachable_executed_at_comptime.zig
blob: 6d2e53413685778a9fa61396cab5b6acdd2e9ad3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
fn foo(comptime x: i32) i32 {
    comptime {
        if (x >= 0) return -x;
        unreachable;
    }
}
export fn entry() void {
    _ = comptime foo(-42);
}

// error
//
// :4:9: error: reached unreachable code
// :8:21: note: called at comptime here