rust/src/test/run-pass/expr-block-generic-unique2.rs

18 lines
374 B
Rust
Raw Normal View History

// xfail-fast
// -*- rust -*-
#[legacy_modes];
type compare<T> = fn@(T, T) -> bool;
fn test_generic<T: Copy>(expected: T, eq: compare<T>) {
let actual: T = { expected };
assert (eq(expected, actual));
}
fn test_vec() {
2012-08-01 19:30:05 -05:00
fn compare_vec(&&v1: ~int, &&v2: ~int) -> bool { return v1 == v2; }
2012-06-19 21:34:01 -05:00
test_generic::<~int>(~1, compare_vec);
}
fn main() { test_vec(); }