aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/pointless discard.zig
blob: d76889d004904e8c4003e89cb196b9e882d50ee7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
export fn foo() void {
    var x: i32 = 1234;
    x += 1;
    _ = x;
}
export fn bar() void {
    var b: u32 = 1;
    _ = blk: {
        const a = 1;
        b = a;
        break :blk a;
    };
}

// error
//
// :4:9: error: pointless discard of local variable
// :3:5: note: used here