2018-03-15 Steven G. Kargl <kargl@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gnat.dg / nested_proc1.adb
blobb3abf2625787e060d8e8602628893fb1116df490
1 -- { dg-do run }
2 -- Test that a static link is correctly passed to a subprogram which is
3 -- indirectly called through an aggregate.
5 procedure Nested_Proc1 is
7 I : Integer := 0;
9 procedure P1 (X : Integer) is
10 begin
11 I := X;
12 end;
14 type Func_Ptr is access procedure (X : Integer);
16 type Arr is array (1..64) of Integer;
18 type Rec is record
19 F : Func_Ptr;
20 A : Arr;
21 end record;
23 procedure P2 (R : Rec) is
24 begin
25 R.F (1);
26 end;
28 begin
29 P2 ((F => P1'Access, A => (others => 0)));
30 if I /= 1 then
31 raise Program_Error;
32 end if;
33 end;