fix broken cli test and translate-c: support no-op cast

This commit is contained in:
Andrew Kelley 2018-11-05 20:03:16 -05:00
parent 0a495aa563
commit 2928b01afc
2 changed files with 3 additions and 3 deletions

View File

@ -1700,8 +1700,7 @@ static AstNode *trans_implicit_cast_expr(Context *c, TransScope *scope, const Im
emit_warning(c, stmt->getBeginLoc(), "TODO handle C translation cast CK_LValueBitCast");
return nullptr;
case CK_NoOp:
emit_warning(c, stmt->getBeginLoc(), "TODO handle C translation cast CK_NoOp");
return nullptr;
return trans_expr(c, ResultUsedYes, scope, stmt->getSubExpr(), TransRValue);
case CK_BaseToDerived:
emit_warning(c, stmt->getBeginLoc(), "TODO handle C translation cast CK_BaseToDerived");
return nullptr;

View File

@ -127,5 +127,6 @@ fn testGodboltApi(zig_exe: []const u8, dir_path: []const u8) error!void {
const out_asm = try std.io.readFileAlloc(a, example_s_path);
assertOrPanic(std.mem.indexOf(u8, out_asm, "square:") != null);
assertOrPanic(std.mem.indexOf(u8, out_asm, "imul\tedi, edi") != null);
assertOrPanic(std.mem.indexOf(u8, out_asm, "mov\teax, edi") != null);
assertOrPanic(std.mem.indexOf(u8, out_asm, "imul\teax, edi") != null);
}