diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index a4c9eb6841..6a3ee12b17 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -3085,7 +3085,9 @@ void Sema::CheckArrayAccess(const clang::ArraySubscriptExpr *ae) { dyn_cast<DeclRefExpr>(ae->getBase()->IgnoreParenImpCasts()); if (!dr) return; - const VarDecl *vd = cast<VarDecl>(dr->getDecl()); + const VarDecl *vd = dyn_cast<VarDecl>(dr->getDecl()); + if (!vd) + return; const ConstantArrayType *cat = Context.getAsConstantArrayType(vd->getType()); if (!cat) return; |