forked from OSchip/llvm-project
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
This commit is contained in:
parent
22a0d616f6
commit
2ed9afd777
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue