forked from OSchip/llvm-project
parent
c87c843db7
commit
643169b280
|
@ -735,7 +735,15 @@ void InitListChecker::CheckScalarType(const InitializedEntity &Entity,
|
|||
unsigned &Index,
|
||||
InitListExpr *StructuredList,
|
||||
unsigned &StructuredIndex) {
|
||||
if (Index < IList->getNumInits()) {
|
||||
if (Index >= IList->getNumInits()) {
|
||||
SemaRef.Diag(IList->getLocStart(), diag::err_empty_scalar_initializer)
|
||||
<< IList->getSourceRange();
|
||||
hadError = true;
|
||||
++Index;
|
||||
++StructuredIndex;
|
||||
return;
|
||||
}
|
||||
|
||||
Expr *expr = IList->getInit(Index);
|
||||
if (InitListExpr *SubIList = dyn_cast<InitListExpr>(expr)) {
|
||||
SemaRef.Diag(SubIList->getLocStart(),
|
||||
|
@ -776,14 +784,6 @@ void InitListChecker::CheckScalarType(const InitializedEntity &Entity,
|
|||
else
|
||||
UpdateStructuredListElement(StructuredList, StructuredIndex, ResultExpr);
|
||||
++Index;
|
||||
} else {
|
||||
SemaRef.Diag(IList->getLocStart(), diag::err_empty_scalar_initializer)
|
||||
<< IList->getSourceRange();
|
||||
hadError = true;
|
||||
++Index;
|
||||
++StructuredIndex;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void InitListChecker::CheckReferenceType(const InitializedEntity &Entity,
|
||||
|
|
Loading…
Reference in New Issue