diff options
Diffstat (limited to 'tests/conformance/8-runtime')
| -rw-r--r-- | tests/conformance/8-runtime/o3_break_continue_leave.zc | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/conformance/8-runtime/o3_break_continue_leave.zc b/tests/conformance/8-runtime/o3_break_continue_leave.zc new file mode 100644 index 0000000..8cd9647 --- /dev/null +++ b/tests/conformance/8-runtime/o3_break_continue_leave.zc @@ -0,0 +1,28 @@ +// expect: 0 0 3 0 dropped/ +// spec 4.10.3: break and continue out of an o3 { } block leave the region like its end or a return, so the o3 depth is back to 0 after the loop and a drop can run again +include rt; +fn main() { + int i = 0, n = 0; + while (i < 10) { + o3 { + if (i == 4) break; + i++; + } + } + rt.put_n(rt.o3_depth); rt.put_c(32); + i = 0; + while (i < 6) { + i++; + o3 { + if (i % 2 == 0) continue; + n++; + } + } + rt.put_n(rt.o3_depth); rt.put_c(32); rt.put_n(n); rt.put_c(32); + for (int k = 0; k < 3; k++) { o3 { if (k == 1) continue; if (k == 2) break; } } + rt.put_n(rt.o3_depth); rt.put_c(32); + { int* p = drop(heap(1), fn() { rt.put_s("dropped"); }); } + rt.put_c(10); + return 0; +} +// zc0: skip |
