| ... | ... | @@ -1493,7 +1493,8 @@ fn transImplicitCastExpr( |
| 1493 | 1493 | } |
| 1494 | 1494 | |
| 1495 | 1495 | const addr = try Tag.address_of.create(c.arena, try transExpr(c, scope, sub_expr, .used)); |
| 1496 | | return maybeSuppressResult(c, scope, result_used, addr); |
| 1496 | const casted = try transCPtrCast(c, scope, expr.getBeginLoc(), dest_type, src_type, addr); |
| 1497 | return maybeSuppressResult(c, scope, result_used, casted); |
| 1497 | 1498 | }, |
| 1498 | 1499 | .NullToPointer => { |
| 1499 | 1500 | return Tag.null_literal.init(); |
| ... | ... | @@ -3156,10 +3157,10 @@ fn transCPtrCast( |
| 3156 | 3157 | const src_child_type = src_ty.getPointeeType(); |
| 3157 | 3158 | const dst_type_node = try transType(c, scope, ty, loc); |
| 3158 | 3159 | |
| 3159 | | if ((src_child_type.isConstQualified() and |
| 3160 | if (!src_ty.isArrayType() and ((src_child_type.isConstQualified() and |
| 3160 | 3161 | !child_type.isConstQualified()) or |
| 3161 | 3162 | (src_child_type.isVolatileQualified() and |
| 3162 | | !child_type.isVolatileQualified())) |
| 3163 | !child_type.isVolatileQualified()))) |
| 3163 | 3164 | { |
| 3164 | 3165 | // Casting away const or volatile requires us to use @intToPtr |
| 3165 | 3166 | const ptr_to_int = try Tag.ptr_to_int.create(c.arena, expr); |