| author | |
| committer | |
| log | b993728f10c213b679def931c2f59c8e64b14660 |
| tree | 385130550ebb3290136828095d136804aee9b24f |
| parent | 29ac68b2537b9a9c67f92cc2a5dd4c35bf1c2b31 |
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" { | ... | @@ -216,3 +216,13 @@ test "switch loop with pointer capture" { |
| 216 | try S.doTheTest(); | 216 | try S.doTheTest(); |
| 217 | try comptime S.doTheTest(); | 217 | try comptime S.doTheTest(); |
| 218 | } | 218 | } |
| 219 | |||
| 220 | test "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 | |||
| 3 | export 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 | ||