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

// error
//
// :2:12: error: error union is discarded
// :2:12: note: consider using 'try', 'catch', or 'if'
// :9:9: error: error set is discarded