diff options
Diffstat (limited to 'src/codegen')
| -rw-r--r-- | src/codegen/c.zig | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig index d7aec355e9..e38aedb125 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -1141,8 +1141,10 @@ pub const DeclGen = struct { if (!payload_ty.hasRuntimeBits()) { // We use the error type directly as the type. - const err_val = if (val.errorUnionIsPayload()) Value.initTag(.zero) else val; - return dg.renderValue(writer, error_ty, err_val, location); + if (val.errorUnionIsPayload()) { + return try writer.writeByte('0'); + } + return dg.renderValue(writer, error_ty, val, location); } if (location != .Initializer) { |
