From 2cf4387931787df36699e976d811003d89ce5aff Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Fri, 15 May 2009 20:29:28 +0000 Subject: [PATCH] I take it back, InstantiateExpr does not check for null. llvm-svn: 71887 --- clang/lib/Sema/SemaTemplateInstantiateStmt.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/clang/lib/Sema/SemaTemplateInstantiateStmt.cpp b/clang/lib/Sema/SemaTemplateInstantiateStmt.cpp index 8bdb42b58f67..957402ac6f66 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateStmt.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateStmt.cpp @@ -98,10 +98,13 @@ Sema::OwningStmtResult TemplateStmtInstantiator::VisitGotoStmt(GotoStmt *S) { Sema::OwningStmtResult TemplateStmtInstantiator::VisitReturnStmt(ReturnStmt *S) { - Sema::OwningExprResult Result = - SemaRef.InstantiateExpr(S->getRetValue(), TemplateArgs); - if (Result.isInvalid()) - return SemaRef.StmtError(); + Sema::OwningExprResult Result = SemaRef.ExprEmpty(); + if (Expr *E = S->getRetValue()) { + Result = SemaRef.InstantiateExpr(E, TemplateArgs); + + if (Result.isInvalid()) + return SemaRef.StmtError(); + } return SemaRef.ActOnReturnStmt(S->getReturnLoc(), move(Result)); }