PR9899: handle pseudo-destructors correctly in noexcept() expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131220 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index 7f15d86..a6d9bb8 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -1750,11 +1750,14 @@
case CallExprClass:
case CXXOperatorCallExprClass:
case CXXMemberCallExprClass: {
+ const CallExpr *CE = cast<CallExpr>(this);
CanThrowResult CT;
if (isTypeDependent())
CT = CT_Dependent;
+ else if (isa<CXXPseudoDestructorExpr>(CE->getCallee()->IgnoreParens()))
+ CT = CT_Cannot;
else
- CT = CanCalleeThrow(C, cast<CallExpr>(this)->getCalleeDecl());
+ CT = CanCalleeThrow(C, CE->getCalleeDecl());
if (CT == CT_Can)
return CT;
return MergeCanThrow(CT, CanSubExprsThrow(C, this));