diff options
author | Ben Langmuir <blangmuir@apple.com> | 2015-01-26 19:04:10 +0000 |
---|---|---|
committer | Ben Langmuir <blangmuir@apple.com> | 2015-01-26 19:04:10 +0000 |
commit | 577b39349e20a5ca39bd4aa04793aa1bdfd6216a (patch) | |
tree | 18139a9c032db8fd2896c843617384e801bda988 /clang/lib/Sema/SemaInit.cpp | |
parent | 611dfed99fc60ce6eb9542b78e80dc8398eb9828 (diff) | |
download | bcm5719-llvm-577b39349e20a5ca39bd4aa04793aa1bdfd6216a.tar.gz bcm5719-llvm-577b39349e20a5ca39bd4aa04793aa1bdfd6216a.zip |
Fix assert instantiating string init of static variable
... when the variable's type is a typedef of a ConstantArrayType. Just
look through the typedef (and any other sugar). We only use the
constant array type here to get the element count.
llvm-svn: 227115
Diffstat (limited to 'clang/lib/Sema/SemaInit.cpp')
-rw-r--r-- | clang/lib/Sema/SemaInit.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index 9aca373d97b..e3548694845 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -149,9 +149,9 @@ static void updateStringLiteralType(Expr *E, QualType Ty) { static void CheckStringInit(Expr *Str, QualType &DeclT, const ArrayType *AT, Sema &S) { // Get the length of the string as parsed. - uint64_t StrLength = - cast<ConstantArrayType>(Str->getType())->getSize().getZExtValue(); - + auto *ConstantArrayTy = + cast<ConstantArrayType>(Str->getType()->getUnqualifiedDesugaredType()); + uint64_t StrLength = ConstantArrayTy->getSize().getZExtValue(); if (const IncompleteArrayType *IAT = dyn_cast<IncompleteArrayType>(AT)) { // C99 6.7.8p14. We have an array of character type with unknown size |