diff options
| author | Matthew Lugg <mlugg@mlugg.co.uk> | 2025-01-22 16:47:45 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-22 16:47:45 +0000 |
| commit | 61fe307d0f05eea901577900f4ab2bdaf0ffb35f (patch) | |
| tree | 540a47aad6da00421777f121c6b9e568f541918f /test/cases/compile_errors/runtime_condition_in_inline_loop.zig | |
| parent | 941677e08318c2baaabc9d0fc87892d1b63487ae (diff) | |
| parent | e864c38cc38095a1496229803465fdd0d079f9c3 (diff) | |
| download | zig-61fe307d0f05eea901577900f4ab2bdaf0ffb35f.tar.gz zig-61fe307d0f05eea901577900f4ab2bdaf0ffb35f.zip | |
Merge pull request #22571 from mlugg/various-fixes-again
compiler: a few fixes
Diffstat (limited to 'test/cases/compile_errors/runtime_condition_in_inline_loop.zig')
| -rw-r--r-- | test/cases/compile_errors/runtime_condition_in_inline_loop.zig | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/cases/compile_errors/runtime_condition_in_inline_loop.zig b/test/cases/compile_errors/runtime_condition_in_inline_loop.zig new file mode 100644 index 0000000000..65ed3d0367 --- /dev/null +++ b/test/cases/compile_errors/runtime_condition_in_inline_loop.zig @@ -0,0 +1,16 @@ +var rt_slice: []const u8 = &.{ 1, 2, 3 }; + +export fn foo() void { + inline for (rt_slice) |_| {} +} + +export fn bar() void { + inline while (rt_slice.len == 0) {} +} + +// error +// +// :4:17: error: unable to resolve comptime value +// :4:17: note: inline loop condition must be comptime-known +// :8:32: error: unable to resolve comptime value +// :8:32: note: inline loop condition must be comptime-known |
