diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp index 6014e65e9166..2e8aea5e43c3 100644 --- a/clang/lib/CodeGen/CGExprCXX.cpp +++ b/clang/lib/CodeGen/CGExprCXX.cpp @@ -656,8 +656,9 @@ void CodeGenFunction::EmitDeleteCall(const FunctionDecl *DeleteFD, QualType SizeTy; if (DeleteFTy->getNumArgs() == 2) { SizeTy = DeleteFTy->getArgType(1); - uint64_t DeleteTypeSize = getContext().getTypeSize(DeleteTy) / 8; - Size = llvm::ConstantInt::get(ConvertType(SizeTy), DeleteTypeSize); + CharUnits DeleteTypeSize = getContext().getTypeSizeInChars(DeleteTy); + Size = llvm::ConstantInt::get(ConvertType(SizeTy), + DeleteTypeSize.getQuantity()); } if (DeleteFD->getOverloadedOperator() == OO_Array_Delete &&