authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-07-14 10:02:37-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-07-14 10:02:37-07:00
logb993728f10c213b679def931c2f59c8e64b14660
tree385130550ebb3290136828095d136804aee9b24f
parent29ac68b2537b9a9c67f92cc2a5dd4c35bf1c2b31

make it a behavior test instead

It's important to check for correct runtime behavior, rather than only checking that the compiler does not crash.

2 files changed, 10 insertions(+), 12 deletions(-)

test/behavior/switch_loop.zig+10
......@@ -216,3 +216,13 @@ test "switch loop with pointer capture" {
216216 try S.doTheTest();
217217 try comptime S.doTheTest();
218218}
219
220test "unanalyzed continue with operand" {
221 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
222
223 @setRuntimeSafety(false);
224 label: switch (false) {
225 false => if (false) continue :label true,
226 true => {},
227 }
228}
test/cases/discard_labeled_switch_tag.zig deleted-12
......@@ -1,12 +0,0 @@
1// https://github.com/ziglang/zig/issues/24323
2
3export fn f() void {
4 const x: u32 = 0;
5 sw: switch (x) {
6 else => if (false) continue :sw undefined,
7 }
8}
9
10// compile
11// backend=stage2,llvm
12// target=native