summaryrefslogtreecommitdiffstats
path: root/clang
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
commit2ed9afd777aae28dd4c8572276c2239d9ad89667 (patch)
tree93a6f3a315875174b88031883b34a2b317e932fa /clang
parent22a0d616f6e5baf6d2c345821fd6a7635108c792 (diff)
downloadbcm5719-llvm-2ed9afd777aae28dd4c8572276c2239d9ad89667.tar.gz
bcm5719-llvm-2ed9afd777aae28dd4c8572276c2239d9ad89667.zip
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
Diffstat (limited to 'clang')
-rw-r--r--clang/Sema/SemaDecl.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/Sema/SemaDecl.cpp b/clang/Sema/SemaDecl.cpp
index 9907c06f2b5..8d5c69915db 100644
--- a/clang/Sema/SemaDecl.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud