aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/sub_sat_on_undefined_value.zig
blob: 967f24130e08dfcebd7d48803168ac18c5ed709c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
comptime {
    const undef: i64 = undefined;
    const not_undef: i64 = 32;

    // If the RHS is zero, then the LHS is returned, even if it is undefined.
    @compileLog(undef -| 0);
    @compileLog(not_undef -| 0);
    // If either of the operands are undefined, the result is undefined.
    @compileLog(undef -| not_undef);
    @compileLog(not_undef -| undef);
    @compileLog(undef -| undef);
}

// error
// backend=stage2
// target=native
//
// :6:5: error: found compile log statement
//
// Compile Log Output:
// @as(i64, undefined)
// @as(i64, 32)
// @as(i64, undefined)
// @as(i64, undefined)
// @as(i64, undefined)