diff options
Diffstat (limited to 'src/codegen')
| -rw-r--r-- | src/codegen/c.zig | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig index c1b7bd72b1..d06f01c2c3 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -596,9 +596,11 @@ pub const DeclGen = struct { }, location, ), - .int => |int| try writer.print("{x}", .{ - try dg.fmtIntLiteral(Type.usize, int.toValue(), .Other), - }), + .int => |int| { + try writer.writeByte('('); + try dg.renderCType(writer, ptr_cty); + try writer.print("){x}", .{try dg.fmtIntLiteral(Type.usize, int.toValue(), .Other)}); + }, .eu_payload, .opt_payload => |base| { const ptr_base_ty = mod.intern_pool.typeOf(base).toType(); const base_ty = ptr_base_ty.childType(mod); |
