aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/torture/traits8.rs
blob: cc0875bd07571cc97cc73d9a203308f055b5ab93 (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
#[lang = "sized"]
pub trait Sized {}

trait Foo {
    fn default() -> i32;
}

struct Bar(i32);
// { dg-warning "struct is never constructed" "" { target *-*-* } .-1 }

impl Foo for Bar {
    fn default() -> i32 {
        123
    }
}

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

fn main() {
    let a;
    a = type_bound_test::<Bar>();
}