summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/opt57.ads
blob: 1bee7992b1508b7b90e11310fc70e83e442e79d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
-- { dg-do compile }
-- { dg-options "-O3" }

with Ada.Finalization; use Ada.Finalization;
with Opt57_Pkg; use Opt57_Pkg;

package Opt57 is

   procedure Update;

   procedure Init;

   type Module_Factory is abstract new Limited_Controlled with private;

   type Root_Module_Rec (Language : access Module_Factory'Class)
   is abstract new GC_Pool with null record;

   type List is tagged limited private;
   type Linkable is abstract new Root_Module_Rec with private;
   type Linkable_Ptr is access all Linkable'Class;

private

   type Link is access all List'Class;
   type Link_Constant is access constant List'Class;
   type List is tagged limited record
      Next : Link;
   end record;

   type Links_Type (Container : access Linkable) is new List with null record;

   type Linkable is abstract new Root_Module_Rec with record
      On_List : Link_Constant;
      Links   : aliased Links_Type (Linkable'Access);
   end record;

   type Module_Rec (Language : access Module_Factory'Class)
   is abstract new Linkable (Language) with null record;
   type Module_Ptr is access all Module_Rec'Class;

   type Private_Module_Factory;
   type Private_Module_Factory_Ptr is access Private_Module_Factory;

   type Module_Factory is abstract new Limited_Controlled with record
      Priv : Private_Module_Factory_Ptr;
   end record;

   type Module_Factory_Ptr is access all Module_Factory'Class;

end Opt57;