This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
This patch corrects the machinery which identifies an object as being a transient variable. Objects which denote Ada containers in the context of iterator loops are not considered transients and now share the life time of the related loop. ------------ -- Source -- ------------ pragma Ada_2012; with Ada.Containers.Doubly_Linked_Lists; with Ada.Text_IO; use Ada.Text_IO; procedure Main is package Lists is new Ada.Containers.Doubly_Linked_Lists (Integer); use Lists; function Get_Tmp_List return Lists.List; function Get_Tmp_List return Lists.List is Tmp : Lists.List; begin Tmp.Append (1); Tmp.Append (2); Tmp.Append (3); return Tmp; end Get_Tmp_List; begin for A in Get_Tmp_List.Iterate loop Put_Line ("Index => " & Element (A)'Img); end loop; end Main; ---------------------------- -- Compilation and output -- ---------------------------- $ gnatmake -q -gnat12 main.adb $ ./main $ Index => 1 $ Index => 2 $ Index => 3 Tested on x86_64-pc-linux-gnu, committed on trunk 2011-12-20 Hristian Kirtchev <kirtchev@adacore.com> * exp_util.adb: Add with and use clause for Aspects. (Is_Finalizable_Transient): Objects which denote Ada containers in the context of iterators are not considered transients. Such object must live for as long as the loop is around. (Is_Iterated_Container): New routine.
Attachment:
difs
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |