Corrected date in changelog
[official-gcc.git] / gcc / testsuite / gnat.dg / missing_acc_check.adb
blob1c2d9cf502e32602b67c4eedef29c06fd4b7e28b
1 -- { dg-do run }
3 procedure Missing_Acc_Check is
5 Test_Failed : Exception;
7 type Int_Access is access all Integer;
9 Save : Int_Access := null;
11 type Int_Rec is record
12 Int : aliased Integer;
13 end record;
15 type Ltd_Rec (IR_Acc : access Int_Rec) is limited null record;
17 function Pass_Rec (IR_Acc : access Int_Rec) return Int_Access is
18 begin
19 return IR_Acc.Int'Access; -- Accessibility check here
20 end Pass_Rec;
22 procedure Proc is
23 IR : aliased Int_Rec;
24 LR : Ltd_Rec (IR'Access);
25 begin
26 Save := Pass_Rec (LR.IR_Acc); -- Must raise Program_Error;
28 if Save /= null then
29 raise Test_Failed;
30 end if;
32 exception
33 when Program_Error =>
34 null;
35 end Proc;
37 begin
38 Proc;
39 end Missing_Acc_Check;