summaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/torture/traits8.rs
blob: 459032fb4a2d1c0ba49783ac7d3a7597964fc034 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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>();
}