]> granicus.if.org Git - clang/commitdiff
Update the initializer's type, in addition to the decl, if we've changed the type...
authorChristopher Lamb <christopher.lamb@gmail.com>
Thu, 29 Nov 2007 19:09:19 +0000 (19:09 +0000)
committerChristopher Lamb <christopher.lamb@gmail.com>
Thu, 29 Nov 2007 19:09:19 +0000 (19:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44440 91177308-0d34-0410-b5e6-96231b3b80d8

Sema/SemaDecl.cpp

index 9907c06f2b5aa6f62fe072408cb3bdfa6925d2a7..8d5c69915db146fe11a500741498a5d74c5e4f7e 100644 (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);