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
This commit is contained in:
Douglas Gregor 2009-09-29 21:38:53 +00:00
Родитель 0c411806d5
Коммит 1070c9f7ac
2 изменённых файлов: 17 добавлений и 0 удалений

Просмотреть файл

@ -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);

Просмотреть файл

@ -132,3 +132,8 @@ public:
void X4::release(X3 *x) {
delete x;
}
class X6 {
public:
void Destroy() const { delete this; }
};