aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/pointless discard.zig
blob: 14400a442380d63b2b98065018cee75af2a9dbd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
// backend=stage2
// target=native
//
// :4:9: error: pointless discard of local variable
// :3:5: note: used here