Currently, the compiler (like @typeName) writes it `fn(...) Type` but zig fmt writes it `fn (...) Type` (notice the space after `fn`). This inconsistency is now resolved and function types are consistently written the zig fmt way. Before this there were more `fn (...) Type` occurrences than `fn(...) Type` already.
22 lines
455 B
Zig
22 lines
455 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:38: error: expected type 'fn (i32) i32', found 'fn (i32) callconv(.C) i32'
|
|
// :1:38: note: calling convention 'C' cannot cast into calling convention 'Unspecified'
|