P0329R4: Designated Initialization
[official-gcc.git] / gcc / testsuite / gnat.dg / in_out_parameter3.adb
blobdab3f8d52df83bd8aed90e424d7fe4db72e47fca
1 -- { dg-do run }
2 -- { dg-options "-gnat12" }
4 procedure In_Out_Parameter3 is
6 type Arr is array (1..16) of Integer;
8 type Rec1 is record
9 A : Arr;
10 B : Boolean;
11 end record;
13 type Rec2 is record
14 R : Rec1;
15 end record;
16 pragma Pack (Rec2);
18 function F (I : In Out Rec1) return Boolean is
19 A : Integer := I.A (1);
20 begin
21 I.A (1) := I.A (1) + 1;
22 return (A > 0);
23 end;
25 I : Rec2 := (R => (A => (others => 0), B => True));
26 B : Boolean;
28 begin
29 B := F (I.R);
30 if B then
31 raise Program_Error;
32 end if;
33 if I.R.A (1) /= 1 then
34 raise Program_Error;
35 end if;
36 if F (I.R) = False then
37 raise Program_Error;
38 end if;
39 if I.R.A (1) /= 2 then
40 raise Program_Error;
41 end if;
42 end;