aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/ignored_deferred_function_call.zig
blob: 90c978b40fd26c8d51769a6aa4ea1d7bdb4446fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
export fn foo() void {
    defer bar();
}
fn bar() anyerror!i32 {
    return 0;
}

export fn foo2() void {
    defer bar2();
}
fn bar2() anyerror {
    return error.a;
}

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