From f9b4fea4bf6cebe614e49ab4b582dcf4bf0a6806 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Tue, 25 Jun 2013 01:55:41 +0000 Subject: [PATCH] Fix regression from r184810. Specifically, CallExpr::getCalleeDecl() can return null, so make sure to handle that correctly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184813 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaExceptionSpec.cpp | 4 +++- test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/Sema/SemaExceptionSpec.cpp b/lib/Sema/SemaExceptionSpec.cpp index 836385d031..0385c7783e 100644 --- a/lib/Sema/SemaExceptionSpec.cpp +++ b/lib/Sema/SemaExceptionSpec.cpp @@ -895,8 +895,10 @@ CanThrowResult Sema::canThrow(const Expr *E) { CT = CT_Dependent; else if (isa(CE->getCallee()->IgnoreParens())) CT = CT_Cannot; - else + else if (CE->getCalleeDecl()) CT = canCalleeThrow(*this, E, CE->getCalleeDecl()); + else + CT = CT_Can; if (CT == CT_Can) return CT; return mergeCanThrow(CT, canSubExprsThrow(*this, E)); 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 33388cf310..427e8c5007 100644 --- a/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp +++ b/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp @@ -39,6 +39,9 @@ void (*pallspec)() throw(...); void (*pintspec)() throw(int); void (*pemptyspec)() throw(); +typedef void (*funcptr)(); +funcptr returnsptr() throw(); + void callptr() { N(pnospec()); N((*pnospec)()); @@ -48,6 +51,7 @@ void callptr() { N((*pintspec)()); P(pemptyspec()); P((*pemptyspec)()); + N(returnsptr()()); } struct S1 { -- 2.50.1