diff options
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 5c003ed6093..5c31589e0b2 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -5575,11 +5575,13 @@ static QualType TryToFixInvalidVariablyModifiedType(QualType T, if (VLATy->getElementType()->isVariablyModifiedType()) return QualType(); - llvm::APSInt Res; + Expr::EvalResult Result; if (!VLATy->getSizeExpr() || - !VLATy->getSizeExpr()->EvaluateAsInt(Res, Context)) + !VLATy->getSizeExpr()->EvaluateAsInt(Result, Context)) return QualType(); + llvm::APSInt Res = Result.Val.getInt(); + // Check whether the array size is negative. if (Res.isSigned() && Res.isNegative()) { SizeIsNegative = true; |