diff options
-rw-r--r-- | Sema/SemaDecl.cpp | 4 |
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); |