summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorAbramo Bagnara <abramo.bagnara@gmail.com>2011-11-16 15:42:13 +0000
committerAbramo Bagnara <abramo.bagnara@gmail.com>2011-11-16 15:42:13 +0000
commitd4756b9eceba71e8c61ecf85e9f536e350b36658 (patch)
treec2fc6e05584b10e750fdcb546f4a7da4a5c4fd44 /clang/lib
parent4ba7c2abc29be01c3782a3dac5b8a36c500cb2d3 (diff)
downloadbcm5719-llvm-d4756b9eceba71e8c61ecf85e9f536e350b36658.tar.gz
bcm5719-llvm-d4756b9eceba71e8c61ecf85e9f536e350b36658.zip
Fixed missing cast and wrong cast kind in delete expression.
llvm-svn: 144796
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaExprCXX.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index b4db312d6cc..edb4fef3484 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -1861,14 +1861,17 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,
}
}
+ // Perform lvalue-to-rvalue cast, if needed.
+ Ex = DefaultLvalueConversion(Ex.take());
+
// C++ [expr.delete]p2:
// [Note: a pointer to a const type can be the operand of a
// delete-expression; it is not necessary to cast away the constness
// (5.2.11) of the pointer expression before it is used as the operand
// of the delete-expression. ]
if (!Context.hasSameType(Ex.get()->getType(), Context.VoidPtrTy))
- Ex = Owned(ImplicitCastExpr::Create(Context, Context.VoidPtrTy, CK_NoOp,
- Ex.take(), 0, VK_RValue));
+ Ex = Owned(ImplicitCastExpr::Create(Context, Context.VoidPtrTy,
+ CK_BitCast, Ex.take(), 0, VK_RValue));
if (Pointee->isArrayType() && !ArrayForm) {
Diag(StartLoc, diag::warn_delete_array_type)
OpenPOWER on IntegriCloud