diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Sema.zig | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index 1430e80ac0..b1267e195f 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -7273,9 +7273,14 @@ fn zirSwitchCapture( } }, else => { - return sema.fail(block, operand_src, "switch on type '{}' provides no capture value", .{ - operand_ty.fmt(target), - }); + // In this case the capture value is just the passed-through value of the + // switch condition. + if (is_ref) { + assert(operand_is_ref); + return operand_ptr; + } else { + return operand; + } }, } } |
