From: Christopher Lamb Date: Thu, 29 Nov 2007 19:09:19 +0000 (+0000) Subject: Update the initializer's type, in addition to the decl, if we've changed the type... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=48b1239860f0cc372f0e54588aa5e200abe6fcf2;p=clang Update the initializer's type, in addition to the decl, if we've changed the type of the decl based on it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44440 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp index 9907c06f2b..8d5c69915d 100644 --- a/Sema/SemaDecl.cpp +++ b/Sema/SemaDecl.cpp @@ -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);