summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaChecking.cpp
diff options
context:
space:
mode:
authorBruno Ricci <riccibrun@gmail.com>2019-03-25 21:37:10 +0000
committerBruno Ricci <riccibrun@gmail.com>2019-03-25 21:37:10 +0000
commit95550e412f3a998797d08463f4fac6b782f4766b (patch)
treeb089f7d3a5a5eeeddb4b253ce0bf05611063de34 /clang/lib/Sema/SemaChecking.cpp
parent77bf2e3704c4b1f27804d5bc08836cd0a3d8486f (diff)
downloadbcm5719-llvm-95550e412f3a998797d08463f4fac6b782f4766b.tar.gz
bcm5719-llvm-95550e412f3a998797d08463f4fac6b782f4766b.zip
[Sema] Don't check for array bounds when the types in the base expression are dependent
Bail-out of CheckArrayAccess when the types of the base expression before and after eventual casts are dependent. We will get another chance to check for array bounds during instantiation. Fixes PR41087. Differential Revision: https://reviews.llvm.org/D59776 Reviewed By: efriedma llvm-svn: 356957
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 8f710cad6ff..b9b14a0ede5 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -12522,6 +12522,8 @@ void Sema::CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr,
return;
const Type *BaseType = ArrayTy->getElementType().getTypePtr();
+ if (EffectiveType->isDependentType() || BaseType->isDependentType())
+ return;
Expr::EvalResult Result;
if (!IndexExpr->EvaluateAsInt(Result, Context, Expr::SE_AllowSideEffects))
OpenPOWER on IntegriCloud