PR target/84336
[official-gcc.git] / gcc / testsuite / gnat.dg / access_test.adb
blob6266b725a7952be05560c14d5f9ebf9ca5107dff
1 -- { dg-do run }
3 procedure Access_Test is
5 type T1 is tagged null record;
7 procedure Proc_1 (P : access T1'Class) is
8 type Ref is access T1'Class;
9 X : Ref := new T1'Class'(P.all); -- Should always work (no exception)
11 begin
12 null;
13 end;
15 procedure Proc_2 is
16 type T2 is new T1 with null record;
17 X2 : aliased T2;
19 begin
20 Proc_1 (X2'access);
22 declare
23 type T3 is new T1 with null record;
24 X3 : aliased T3;
26 begin
27 Proc_1 (X3'access);
28 end;
29 end;
31 begin
32 Proc_2;
33 end;