From ba79fc2d1b742e34df104aadb2780725c2a882fc Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Thu, 16 Apr 2009 17:49:48 +0000 Subject: [PATCH] Attempt to fix a read-after-free running test/Sema/designated-initializers.c. Douglas, can you check that this is doing the right thing? git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69298 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaInit.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index a0f4e4ac38..28b25565b1 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -1234,15 +1234,15 @@ InitListChecker::CheckDesignatedInitializer(InitListExpr *IList, ExpandAnonymousFieldDesignator(SemaRef, DIE, DesigIdx, cast(*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((*Field)->getDeclContext()) -- 2.50.1