summary refs log tree commit diff
path: root/src/test/codegen/catch-unwind.rs
blob: 3c9bc35d1c8bd4dd4de9a4e87525a070ace88920 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// compile-flags: -O

#![crate_type = "lib"]

extern "C" {
    fn bar();
}

// CHECK-LABEL: @foo
#[no_mangle]
pub unsafe fn foo() -> i32 {
    // CHECK: call void @bar
    // CHECK: ret i32 0
    std::panic::catch_unwind(|| {
        bar();
        0
    })
    .unwrap()
}