[cfe-commits] r131220 - in /cfe/trunk: lib/AST/Expr.cpp test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp

Eli Friedman eli.friedman at gmail.com
Wed May 11 19:11:32 PDT 2011


Author: efriedma
Date: Wed May 11 21:11:32 2011
New Revision: 131220

URL: http://llvm.org/viewvc/llvm-project?rev=131220&view=rev
Log:
PR9899: handle pseudo-destructors correctly in noexcept() expressions.


Modified:
    cfe/trunk/lib/AST/Expr.cpp
    cfe/trunk/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp

Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=131220&r1=131219&r2=131220&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Wed May 11 21:11:32 2011
@@ -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));

Modified: cfe/trunk/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp?rev=131220&r1=131219&r2=131220&view=diff
==============================================================================
--- cfe/trunk/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp (original)
+++ cfe/trunk/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp Wed May 11 21:11:32 2011
@@ -97,6 +97,8 @@
   void operator delete(void*) throw(int);
 };
 
+typedef int X;
+
 void implicits() {
   N(new int);
   P(new (0) int);
@@ -113,6 +115,7 @@
   N(static_cast<int>(s));
   P(static_cast<float>(s));
   N(Bad1());
+  P(X().~X());
 }
 
 struct V {





More information about the cfe-commits mailing list