aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/torture/function_reference3.rs
blob: 0cb3181f4a16f024e7ed87195d903db135563acd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
struct Foo {
    a: fn(i32) -> i32,
    b: i32,
}

fn test(a: i32) -> i32 {
    a + 1
}

fn main() {
    let a = test(1);
    // { dg-warning "unused name" "" { target *-*-* } .-1 }

    let b: fn(i32) -> i32 = test;
    let c = b(1);

    let d = Foo { a: test, b: c };
    let e = (d.a)(d.b);
    // { dg-warning "unused name" "" { target *-*-* } .-1 }
}