diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-09-29 21:38:53 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-09-29 21:38:53 +0000 |
commit | 1070c9f7acc889336be6f80c70dc1b32622cc83d (patch) | |
tree | 7f7621c906ba3fd664be5c657fff0f7688334978 /lib/Sema/SemaExprCXX.cpp | |
parent | 0c411806d540f7158bf12fee5c10f7de2647de76 (diff) |
The C++ delete expression strips cv-qualifiers from the pointed-to type. My previous fix eliminated this behavior, so bring it back again.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83113 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExprCXX.cpp')
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 5846866dc6..0ad18cdb31 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -849,6 +849,18 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, << Ex->getSourceRange())) return ExprError(); + // 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. ] + ImpCastExprToType(Ex, Context.getPointerType(Context.VoidTy), + CastExpr::CK_NoOp); + + // Update the operand. + Operand.take(); + Operand = ExprArg(*this, Ex); + DeclarationName DeleteName = Context.DeclarationNames.getCXXOperatorName( ArrayForm ? OO_Array_Delete : OO_Delete); |