]> granicus.if.org Git - clang/commitdiff
Replace r213816's fix with a different one. It's not meaningful to call
authorRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 23 Jul 2014 23:50:25 +0000 (23:50 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 23 Jul 2014 23:50:25 +0000 (23:50 +0000)
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

lib/AST/ExprConstant.cpp

index 11789aa037f0f2199b40e9f8404f8316136219dd..9bd630a272fd7dc874ff3049908bf33f5681ff9e 100644 (file)
@@ -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<const ValueDecl*>();
     Info.Diag(Loc, diag::note_constexpr_past_end, 1)
       << !Designator.Entries.empty() << !!VD << VD;