diff options
-rw-r--r-- | lib/CodeGen/CGExprCXX.cpp | 5 | ||||
-rw-r--r-- | test/CodeGenCXX/delete.cpp | 10 |
2 files changed, 13 insertions, 2 deletions
diff --git a/lib/CodeGen/CGExprCXX.cpp b/lib/CodeGen/CGExprCXX.cpp index 5e417605b1..e0c8280e6b 100644 --- a/lib/CodeGen/CGExprCXX.cpp +++ b/lib/CodeGen/CGExprCXX.cpp @@ -1018,8 +1018,9 @@ void CodeGenFunction::EmitCXXDeleteExpr(const CXXDeleteExpr *E) { Ptr = Builder.CreateInBoundsGEP(Ptr, GEP.begin(), GEP.end(), "del.first"); } - assert(ConvertType(DeleteTy) == - cast<llvm::PointerType>(Ptr->getType())->getElementType()); + assert(DeleteTy->isBooleanType() || + (ConvertType(DeleteTy) == + cast<llvm::PointerType>(Ptr->getType())->getElementType())); if (E->isArrayForm()) { EmitArrayDelete(*this, E->getOperatorDelete(), Ptr, DeleteTy); diff --git a/test/CodeGenCXX/delete.cpp b/test/CodeGenCXX/delete.cpp index ec13d0cc0f..1f52a783e6 100644 --- a/test/CodeGenCXX/delete.cpp +++ b/test/CodeGenCXX/delete.cpp @@ -95,3 +95,13 @@ namespace test1 { // CHECK: call void @_ZdaPv(i8* [[ALLOC]]) } } + +namespace test2 { + // CHECK: define void @_ZN5test21fEPb + void f(bool *b) { + // CHECK: call void @_ZdlPv(i8* + delete b; + // CHECK: call void @_ZdaPv(i8* + delete [] b; + } +} |