diff options
author | Chris Lattner <sabre@nondot.org> | 2008-04-02 01:05:10 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-04-02 01:05:10 +0000 |
commit | fd89bc825026e44c68a68db72d4012fd6752e70f (patch) | |
tree | 1a44d1628d544d8da60ac6b3cb9dcc1cc9568765 /lib/Sema/SemaType.cpp | |
parent | c822ff47d29eb3888796145dbc58d17f747a1e61 (diff) |
Fix PR2017 and silence some bogus errors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49068 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r-- | lib/Sema/SemaType.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index d4cb979563..ad9d138f91 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -203,7 +203,7 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S) { DeclType.Ref.AttrList = ProcessTypeAttributes(T, AL); break; case DeclaratorChunk::Array: { - const DeclaratorChunk::ArrayTypeInfo &ATI = DeclType.Arr; + DeclaratorChunk::ArrayTypeInfo &ATI = DeclType.Arr; Expr *ArraySize = static_cast<Expr*>(ATI.NumElts); ArrayType::ArraySizeModifier ASM; if (ATI.isStar) @@ -246,9 +246,11 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S) { Diag(ArraySize->getLocStart(), diag::err_array_size_non_int, ArraySize->getType().getAsString(), ArraySize->getSourceRange()); D.setInvalidType(true); + delete ArraySize; + ATI.NumElts = ArraySize = 0; } llvm::APSInt ConstVal(32); - // If no expression was provided, we consider it a VLA. + // If no expression was provided, we consider it an incomplete array. if (!ArraySize) { T = Context.getIncompleteArrayType(T, ASM, ATI.TypeQuals); } else if (!ArraySize->isIntegerConstantExpr(ConstVal, Context)) { |