aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/traits7.rs
blob: 68f3f38f97bd086c4dd6f9086a2079a98e12efe9 (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
25
26
27
#[lang = "sized"]
pub trait Sized {}

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 }
}