aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/traits7.rs
blob: 825553ce4966eca829ebc2e8869c94704e2228b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
trait Foo {
    fn default() -> i32;
}

trait Bar {
    fn not_default() -> i32;
}

struct Test(i32);

impl Foo for Test {
    fn default() -> i32 {
        1234
    }
}

fn type_bound_test<T: Foo + Bar>() -> i32 {
    T::default()
}

fn main() {
    let a = type_bound_test::<Test>();
    // { dg-error "bounds not satisfied for Test" "" { target *-*-* } .-1 }
}