1-- { dg-do compile }
2-- { dg-options "-O3" }
3
4with Ada.Finalization; use Ada.Finalization;
5with Opt57_Pkg; use Opt57_Pkg;
6
7package Opt57 is
8
9   procedure Update;
10
11   procedure Init;
12
13   type Module_Factory is abstract new Limited_Controlled with private;
14
15   type Root_Module_Rec (Language : access Module_Factory'Class)
16   is abstract new GC_Pool with null record;
17
18   type List is tagged limited private;
19   type Linkable is abstract new Root_Module_Rec with private;
20   type Linkable_Ptr is access all Linkable'Class;
21
22private
23
24   type Link is access all List'Class;
25   type Link_Constant is access constant List'Class;
26   type List is tagged limited record
27      Next : Link;
28   end record;
29
30   type Links_Type (Container : access Linkable) is new List with null record;
31
32   type Linkable is abstract new Root_Module_Rec with record
33      On_List : Link_Constant;
34      Links   : aliased Links_Type (Linkable'Access);
35   end record;
36
37   type Module_Rec (Language : access Module_Factory'Class)
38   is abstract new Linkable (Language) with null record;
39   type Module_Ptr is access all Module_Rec'Class;
40
41   type Private_Module_Factory;
42   type Private_Module_Factory_Ptr is access Private_Module_Factory;
43
44   type Module_Factory is abstract new Limited_Controlled with record
45      Priv : Private_Module_Factory_Ptr;
46   end record;
47
48   type Module_Factory_Ptr is access all Module_Factory'Class;
49
50end Opt57;
51