3 with Text_IO
; use Text_IO
;
4 with Ada
.Finalization
; use Ada
.Finalization
;
6 procedure Nested_Controlled_Alloc
is
8 package Controlled_Alloc
is
10 type Fin
is new Limited_Controlled
with null record;
11 procedure Finalize
(X
: in out Fin
);
15 type T
is limited private;
16 type Ref
is access all T
;
20 type T
is new Limited_Controlled
with null record;
21 procedure Finalize
(X
: in out T
);
25 package body Controlled_Alloc
is
27 procedure Finalize
(X
: in out T
) is
29 Put_Line
("Finalize (T)");
32 procedure Finalize
(X
: in out Fin
) is
37 raise Constraint_Error
;
49 end Nested_Controlled_Alloc
;