aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-07-19 17:45:38 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-07-19 17:45:38 -0700
commit1d5f865cfafdaa96cac35ada9bb9e8b1a4e2bc36 (patch)
tree2715c03bfc0fff3e2a5845db86019912062d1dfa /test
parent046df9b7d001120a0142ea29c86cfb3b9ae4eadf (diff)
downloadzig-1d5f865cfafdaa96cac35ada9bb9e8b1a4e2bc36.tar.gz
zig-1d5f865cfafdaa96cac35ada9bb9e8b1a4e2bc36.zip
Sema: fix runtime instructions omitted
in the presence of comptime control flow. fixes #12171
Diffstat (limited to 'test')
-rw-r--r--test/behavior/eval.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/behavior/eval.zig b/test/behavior/eval.zig
index dde27afe3f..6c86185afb 100644
--- a/test/behavior/eval.zig
+++ b/test/behavior/eval.zig
@@ -1261,3 +1261,14 @@ test "comptime write through extern struct reinterpreted as array" {
assert(s.c == 3);
}
}
+
+test "continue nested in a conditional in an inline for" {
+ var x: u32 = 1;
+ inline for ([_]u8{ 1, 2, 3 }) |_| {
+ if (1 == 1) {
+ x = 0;
+ continue;
+ }
+ }
+ try expect(x == 0);
+}