From: Richard Smith Date: Wed, 23 Jul 2014 23:50:25 +0000 (+0000) Subject: Replace r213816's fix with a different one. It's not meaningful to call X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=30c7311ea59c736ed97d809cbd68d43e40e23ee2;p=clang Replace r213816's fix with a different one. It's not meaningful to call isOnePastTheEnd on an invalid designator, so assert and push the check into the one caller that wasn't already checking. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@213820 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index 11789aa037..9bd630a272 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -201,8 +201,7 @@ namespace { /// Determine whether this is a one-past-the-end pointer. bool isOnePastTheEnd() const { - if (Invalid) - return false; + assert(!Invalid); if (IsOnePastTheEnd) return true; if (MostDerivedArraySize && @@ -1310,7 +1309,7 @@ static bool CheckLValueConstantExpression(EvalInfo &Info, SourceLocation Loc, } // Does this refer one past the end of some object? - if (Designator.isOnePastTheEnd()) { + if (!Designator.Invalid && Designator.isOnePastTheEnd()) { const ValueDecl *VD = Base.dyn_cast(); Info.Diag(Loc, diag::note_constexpr_past_end, 1) << !Designator.Entries.empty() << !!VD << VD;