Update the initializer's type, in addition to the decl, if we've changed the type of the decl based on it.

llvm-svn: 44440
This commit is contained in:
Christopher Lamb 2007-11-29 19:09:19 +00:00
parent 22a0d616f6
commit 2ed9afd777
1 changed files with 3 additions and 1 deletions

View File

@ -727,8 +727,10 @@ void Sema::AddInitializerToDecl(DeclTy *dcl, ExprTy *init) {
// completed by the initializer. For example:
// int ary[] = { 1, 3, 5 };
// "ary" transitions from a VariableArrayType to a ConstantArrayType.
if (!VDecl->isInvalidDecl() && (DclT != SavT))
if (!VDecl->isInvalidDecl() && (DclT != SavT)) {
VDecl->setType(DclT);
Init->setType(DclT);
}
// Attach the initializer to the decl.
VDecl->setInit(Init);