Files
zig/test/cases/compile_errors/callconv_from_global_variable.zig
Veikka Tuominen 34e4b07d0c Sema: allow runtime only instructions to be emitted in outside functions
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
2022-10-20 20:11:00 +03:00

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