From cc4bb63351e527682d13a0b06a3ff3e32eaa1c37 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 30 Jun 2016 18:36:34 +0000 Subject: PR28373: fix crash-on-invalid if the condition of an if-statement fails typo-correction. llvm-svn: 274260 --- clang/lib/Sema/SemaExpr.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'clang/lib/Sema/SemaExpr.cpp') diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 56cf5d4fd37..cc2a11fccfb 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -14394,7 +14394,12 @@ Sema::ConditionResult Sema::ActOnCondition(Scope *S, SourceLocation Loc, if (Cond.isInvalid()) return ConditionError(); - return ConditionResult(*this, nullptr, MakeFullExpr(Cond.get(), Loc), + // FIXME: FullExprArg doesn't have an invalid bit, so check nullness instead. + FullExprArg FullExpr = MakeFullExpr(Cond.get(), Loc); + if (!FullExpr.get()) + return ConditionError(); + + return ConditionResult(*this, nullptr, FullExpr, CK == ConditionKind::ConstexprIf); } -- cgit v1.2.3