aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Lamb <christopher.lamb@gmail.com>2007-11-29 19:09:19 +0000
committerChristopher Lamb <christopher.lamb@gmail.com>2007-11-29 19:09:19 +0000
commit48b1239860f0cc372f0e54588aa5e200abe6fcf2 (patch)
treeea0859aaff3b7dea9a3629b26c6b27c5353d61e4
parent502654085f1529ef034be9ad0fd078d32e47ddfa (diff)
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
-rw-r--r--Sema/SemaDecl.cpp4
1 files changed, 3 insertions, 1 deletions
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);