It is possible to get comptime-known values from runtime-known values for example the length of array. Allowing runtime only instructions to be emitted outside function bodies allows these operations to happen. In places where comptime-known values are required we have other methods to ensure that and they usually result in more specific compile errors too. Closes #12240
10 lines
248 B
Zig
10 lines
248 B
Zig
var cc: @import("std").builtin.CallingConvention = .C;
|
|
export fn foo() callconv(cc) void {}
|
|
|
|
// error
|
|
// backend=stage2
|
|
// target=native
|
|
//
|
|
// :2:26: error: unable to resolve comptime value
|
|
// :2:26: note: calling convention must be comptime-known
|