summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/include/clang/AST/ExprCXX.h3
-rw-r--r--clang/lib/AST/ExprCXX.cpp5
2 files changed, 6 insertions, 2 deletions
diff --git a/clang/include/clang/AST/ExprCXX.h b/clang/include/clang/AST/ExprCXX.h
index 3b8ecf29307..78edd4beecc 100644
--- a/clang/include/clang/AST/ExprCXX.h
+++ b/clang/include/clang/AST/ExprCXX.h
@@ -1150,6 +1150,9 @@ public:
Expr *getArgument() { return cast<Expr>(Argument); }
const Expr *getArgument() const { return cast<Expr>(Argument); }
+ /// \brief Retrieve the type being destroyed. If the type being
+ /// destroyed is a dependent type which may or may not be a pointer,
+ /// return an invalid type.
QualType getDestroyedType() const;
virtual SourceRange getSourceRange() const {
diff --git a/clang/lib/AST/ExprCXX.cpp b/clang/lib/AST/ExprCXX.cpp
index 60785d471ac..1820ff77074 100644
--- a/clang/lib/AST/ExprCXX.cpp
+++ b/clang/lib/AST/ExprCXX.cpp
@@ -162,8 +162,9 @@ QualType CXXDeleteExpr::getDestroyedType() const {
}
// The type-to-delete may not be a pointer if it's a dependent type.
const QualType ArgType = Arg->getType();
- if (ArgType->isDependentType())
- return ArgType;
+
+ if (ArgType->isDependentType() && !ArgType->isPointerType())
+ return QualType();
return ArgType->getAs<PointerType>()->getPointeeType();
}
OpenPOWER on IntegriCloud