mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
Sema: Initialise want_safety for switch prong child block
This commit is contained in:
parent
b0dba46800
commit
27d4bf7534
@ -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;
|
||||
|
||||
30
test/cases/inherit_want_safety.zig
Normal file
30
test/cases/inherit_want_safety.zig
Normal 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
|
||||
Loading…
x
Reference in New Issue
Block a user