diff options
| author | amp-59 <114923809+amp-59@users.noreply.github.com> | 2023-12-29 11:42:44 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-29 11:42:44 +0000 |
| commit | 27d4bf753467894836e960bced73740c95e61db8 (patch) | |
| tree | 27e6467784cb9cff21ed81c7209a92b38aa7699e /test | |
| parent | b0dba4680012e47ffc99f87bab4b53a976cb8b8e (diff) | |
| download | zig-27d4bf753467894836e960bced73740c95e61db8.tar.gz zig-27d4bf753467894836e960bced73740c95e61db8.zip | |
Sema: Initialise `want_safety` for switch prong child block
Diffstat (limited to 'test')
| -rw-r--r-- | test/cases/inherit_want_safety.zig | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/cases/inherit_want_safety.zig b/test/cases/inherit_want_safety.zig new file mode 100644 index 0000000000..6a70e603a6 --- /dev/null +++ b/test/cases/inherit_want_safety.zig @@ -0,0 +1,30 @@ +pub const panic = @compileError(""); + +pub export fn entry() usize { + @setRuntimeSafety(false); + var u: usize = 0; + { + u += 1; + } + if (u == 0) { + u += 1; + } + while (u == 0) { + u += 1; + } + for (0..u) |_| { + u += 1; + } + defer { + u += 1; + } + switch (u) { + else => { + u += 1; + }, + } + return u; +} + +// compile +// output_mode=Obj |
