summary refs log tree commit diff
path: root/src/test/ui/issues/issue-2633.rs
blob: 7e8cea75fc8db8198dd41ba1d3f4ef33334cd80c (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
28
29
30
31
// run-pass
#![allow(dead_code)]
#![allow(non_camel_case_types)]

#[derive(Copy, Clone)]
struct cat {
    meow: extern "Rust" fn(),
}

fn meow() {
    println!("meow")
}

fn cat() -> cat {
    cat {
        meow: meow,
    }
}

#[derive(Copy, Clone)]
struct KittyInfo {kitty: cat}

// Code compiles and runs successfully if we add a + before the first arg
fn nyan(kitty: cat, _kitty_info: KittyInfo) {
    (kitty.meow)();
}

pub fn main() {
    let kitty = cat();
    nyan(kitty, KittyInfo {kitty: kitty});
}