diff options
-rw-r--r-- | lib/AST/Expr.cpp | 5 | ||||
-rw-r--r-- | test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 7f15d86a19..a6d9bb8760 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -1750,11 +1750,14 @@ Expr::CanThrowResult Expr::CanThrow(ASTContext &C) const { 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)); diff --git a/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp b/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp index 35a8b0f7d0..6d1e523b51 100644 --- a/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp +++ b/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp @@ -97,6 +97,8 @@ struct Bad2 { void operator delete(void*) throw(int); }; +typedef int X; + void implicits() { N(new int); P(new (0) int); @@ -113,6 +115,7 @@ void implicits() { N(static_cast<int>(s)); P(static_cast<float>(s)); N(Bad1()); + P(X().~X()); } struct V { |