diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-02-16 23:39:09 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-02-16 23:39:09 +0000 |
commit | c71a2c0ce03ec74391ff2b43b0a966860f23786e (patch) | |
tree | 4f9ef51ca97d56eaffac7ba0f3db58be5312673e /lib/Sema/SemaChecking.cpp | |
parent | 05318d835e8beb16ac6bdd2c0db0ab6a922f35cf (diff) |
Fix assertion failure in -Warray-bounds on template parameters used as arrays.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125693 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaChecking.cpp')
-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; |