Sema: Initialise want_safety for switch prong child block

This commit is contained in:
amp-59 2023-12-29 11:42:44 +00:00 committed by GitHub
parent b0dba46800
commit 27d4bf7534
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 0 deletions

View File

@ -11806,6 +11806,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r
.runtime_cond = block.runtime_cond,
.runtime_loop = block.runtime_loop,
.runtime_index = block.runtime_index,
.want_safety = block.want_safety,
.error_return_trace_index = block.error_return_trace_index,
};
const merges = &child_block.label.?.merges;

View File

@ -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