2021-12-01 20:37:06 -06:00
|
|
|
// error-pattern: unwinding past a stack frame that does not allow unwinding
|
2021-03-14 11:03:20 -05:00
|
|
|
#![feature(c_unwind)]
|
|
|
|
|
|
|
|
//! Unwinding when the caller ABI is "C" (without "-unwind") is UB.
|
|
|
|
|
|
|
|
extern "C-unwind" fn unwind() {
|
|
|
|
panic!();
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let unwind: extern "C-unwind" fn() = unwind;
|
|
|
|
let unwind: extern "C" fn() = unsafe { std::mem::transmute(unwind) };
|
|
|
|
std::panic::catch_unwind(|| unwind()).unwrap_err();
|
|
|
|
}
|