Files
zig/test/cases/compile_errors/extern_function_pointer_mismatch.zig
2022-12-14 14:08:21 +02:00

14 lines
430 B
Zig

const fns = [_](fn(i32)i32) { a, b, c };
pub fn a(x: i32) i32 {return x + 0;}
pub fn b(x: i32) i32 {return x + 1;}
export fn c(x: i32) i32 {return x + 2;}
export fn entry() usize { return @sizeOf(@TypeOf(fns)); }
// error
// backend=stage2
// target=native
//
// :1:37: error: expected type 'fn(i32) i32', found 'fn(i32) callconv(.C) i32'
// :1:37: note: calling convention 'C' cannot cast into calling convention 'Unspecified'