[cfe-commits] r44440 - /cfe/trunk/Sema/SemaDecl.cpp

Christopher Lamb christopher.lamb at gmail.com
Thu Nov 29 11:09:19 PST 2007


Author: clamb
Date: Thu Nov 29 13:09:19 2007
New Revision: 44440

URL: http://llvm.org/viewvc/llvm-project?rev=44440&view=rev
Log:
Update the initializer's type, in addition to the decl, if we've changed the type of the decl based on it.

Modified:
    cfe/trunk/Sema/SemaDecl.cpp

Modified: cfe/trunk/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Sema/SemaDecl.cpp?rev=44440&r1=44439&r2=44440&view=diff

==============================================================================
--- cfe/trunk/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/Sema/SemaDecl.cpp Thu Nov 29 13:09:19 2007
@@ -727,8 +727,10 @@
   // 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);





More information about the cfe-commits mailing list