diff options
| author | Veikka Tuominen <git@vexu.eu> | 2023-01-22 17:26:32 +0200 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2023-01-30 15:20:16 +0200 |
| commit | 720d82721fa6013b2e7e7ff2866db9404bfd2901 (patch) | |
| tree | 6ce2b7bb0e2a7134073d47c22fc30739475a5059 /test/cases/compile_errors | |
| parent | 92dfc07489c3f8514792434e2857b419ebf1f208 (diff) | |
| download | zig-720d82721fa6013b2e7e7ff2866db9404bfd2901.tar.gz zig-720d82721fa6013b2e7e7ff2866db9404bfd2901.zip | |
Sema: ensure args to inline comptime args are comptime-known
Closes #14413
Diffstat (limited to 'test/cases/compile_errors')
| -rw-r--r-- | test/cases/compile_errors/inline_call_runtime_value_to_comptime_param.zig | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/cases/compile_errors/inline_call_runtime_value_to_comptime_param.zig b/test/cases/compile_errors/inline_call_runtime_value_to_comptime_param.zig new file mode 100644 index 0000000000..cddd91384b --- /dev/null +++ b/test/cases/compile_errors/inline_call_runtime_value_to_comptime_param.zig @@ -0,0 +1,17 @@ +inline fn needComptime(comptime a: u64) void { + if (a != 0) @compileError("foo"); +} +fn acceptRuntime(value: u64) void { + needComptime(value); +} +pub export fn entry() void { + var value: u64 = 0; + acceptRuntime(value); +} + +// error +// backend=stage2 +// target=native +// +// :5:18: error: unable to resolve comptime value +// :5:18: note: parameter is comptime |
