Attempt to fix a read-after-free running test/Sema/designated-initializers.c.

Douglas, can you check that this is doing the right thing?

llvm-svn: 69298
This commit is contained in:
Eli Friedman 2009-04-16 17:49:48 +00:00
parent 027aa3cb0e
commit 8d25b096fa
1 changed files with 3 additions and 3 deletions

View File

@ -1234,15 +1234,15 @@ InitListChecker::CheckDesignatedInitializer(InitListExpr *IList,
ExpandAnonymousFieldDesignator(SemaRef, DIE, DesigIdx,
cast<FieldDecl>(*Lookup.first),
Field, FieldIndex);
D = DIE->getDesignator(DesigIdx);
} else {
// Name lookup found something, but it wasn't a field.
SemaRef.Diag(D->getFieldLoc(), diag::err_field_designator_nonfield)
<< FieldName;
SemaRef.Diag((*Lookup.first)->getLocation(),
diag::note_field_designator_found);
++Index;
return true;
++Index;
return true;
}
} else if (!KnownField &&
cast<RecordDecl>((*Field)->getDeclContext())