1-- { dg-do run } 2 3with Ada.Text_IO; 4 5procedure Array30 is 6 7 package P is 8 type T is tagged record 9 value : Integer := 123; 10 end record; 11 12 type Ar is array (1..10) of T; 13 function F (Obj : T) return Ar; 14 function F2 (Obj : T) return T; 15 end P; 16 use P; 17 18 package body P is 19 function F (Obj : T) return Ar is 20 begin 21 return (others => <>); 22 end; 23 24 function F2 (Obj : T) return T is 25 begin 26 return (value => -111); 27 end F2; 28 end P; 29 30 Thing : T; 31begin 32 if Thing.F (4).Value /= 0 then 33 if Thing.F (5).Value /= 123 then 34 raise Program_Error; 35 end if; 36 if Thing.F (5).F2.Value /= -111 then 37 raise Program_Error; 38 end if; 39 end if; 40end; 41