rust/tests/run-pass/function_pointers.rs

16 lines
171 B
Rust

fn f() -> i32 {
42
}
fn return_fn_ptr() -> fn() -> i32 {
f
}
fn call_fn_ptr() -> i32 {
return_fn_ptr()()
}
fn main() {
assert_eq!(call_fn_ptr(), 42);
}