Closed
Description
compile with opt-level >= 2 (works fine with opt-level=0)
fn identity(a: &u32) -> &u32 { a }
fn print_foo(f: &fn(&u32) -> &u32, x: &u32) {
println!("{}", (*f)(x));
}
fn main() {
let x = &4;
let f: fn(&u32) -> &u32 = identity;
print_foo(&f, x); // prints 32597 for me
}
rustc 0.13.0-nightly (ad9e75938 2015-01-05 00:26:28 +0000)
binary: rustc
commit-hash: ad9e759382ad7daed26f86732f41f5f83cd673e2
commit-date: 2015-01-05 00:26:28 +0000
host: x86_64-unknown-linux-gnu
release: 0.13.0-nightly