rust/tests/run-pass/function_pointers.rs

16 lines
171 B
Rust
Raw Normal View History

2016-06-08 06:43:34 -05:00
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);
}