aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/discarding_error_value.zig
blob: eab3ecaf984de84f21433a6e9450da71165ccdd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
export fn entry1() void {
    _ = foo();
}
fn foo() !void {
    return error.OutOfMemory;
}
export fn entry2() void {
    const x: error{a} = undefined;
    _ = x;
}

// error
// backend=stage2
// target=native
//
// :2:12: error: error union is discarded
// :2:12: note: consider using 'try', 'catch', or 'if'
// :9:9: error: error set is discarded