Skip to content

app node argument has type fn[…] but the callee was expecting closure […] #159

@michael-kenzel

Description

@michael-kenzel

This bug seems to only trigger on Windows (possibly only when built with MSVC).

The following example will reproduce the bug (compile with --emit-llvm, removing pretty much anything makes the bug disappear):

// any fewer functions will not trigger the bug
// any change to the type of any function makes the bug disappear as well
#[import(name = "A")] fn A(&mut u64, u64) -> u64;
#[import(name = "B")] fn B(&mut i32, i32) -> i32;
#[import(name = "C")] fn C(&mut u32, u32) -> u32;
#[import(name = "D")] fn D(&mut u64, u64) -> u64;

struct thing {
	A: fn() -> (),
	B: fn() -> (),
	C: fn() -> (),
	D: fn() -> (),
}

fn @wrap[T](f: fn(&mut T, T) -> T) {
	@|| -> () {}
}

fn @invoke(body: fn(thing) -> ()) -> () {
	@body(thing {
		A = wrap[u64](A),
		B = wrap[i32](B),
		C = wrap[u32](C),
		D = wrap[u64](D),
	})
}

#[export]
fn print_info(_device: i32) {
	invoke(|_|{});
}

#[export]
fn run(_device: i32, _argc: i32, _argv: &mut u8) {
	invoke(|_|{});
}

results in

assertion 'pt == at' failed in src\thorin\continuation.cpp:57: app node argument wrap_892(run_1534.run_1535, A_1555, cont_901) has type fn[mem, pu64*, pu64, fn[mem, pu64]] but the callee was expecting closure [mem, pu64*, pu64, fn[mem, pu64]]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions