| 1 |
-- { dg-do run } |
| 2 |
|
| 3 |
with System.Storage_Elements; use System.Storage_Elements; |
| 4 |
with System.Storage_Pools.Subpools; use System.Storage_Pools.Subpools; |
| 5 |
|
| 6 |
procedure Subpools2 is |
| 7 |
|
| 8 |
B : Storage_Array (1 .. 128) with Alignment => Standard'Maximum_Alignment; |
| 9 |
|
| 10 |
type Pool_T is new Root_Storage_Pool_With_Subpools with null record; |
| 11 |
type Subpool_T is new Root_Subpool with null record; |
| 12 |
type Rec is record I : Integer := 0; end record; |
| 13 |
|
| 14 |
overriding function Create_Subpool |
| 15 |
(Pool : in out Pool_T) return not null Subpool_Handle is |
| 16 |
(raise Constraint_Error); |
| 17 |
|
| 18 |
overriding procedure Deallocate_Subpool |
| 19 |
(Pool : in out Pool_T; Subpool : in out Subpool_Handle) is null; |
| 20 |
|
| 21 |
overriding procedure Allocate_From_Subpool |
| 22 |
(Pool : in out Pool_T; |
| 23 |
Storage_Address : out System.Address; |
| 24 |
Size_In_Storage_Elements : Storage_Count; |
| 25 |
Alignment : Storage_Count; |
| 26 |
Subpool : not null Subpool_Handle) is |
| 27 |
begin |
| 28 |
Storage_Address := B'Address; |
| 29 |
end; |
| 30 |
|
| 31 |
Pool : Pool_T; |
| 32 |
Subpool : aliased Subpool_T; |
| 33 |
Handle : Subpool_Handle := Subpool'Unchecked_Access; |
| 34 |
|
| 35 |
type Subpool_A is access Rec with Storage_Pool => Pool; |
| 36 |
Ptr : Subpool_A; |
| 37 |
|
| 38 |
begin |
| 39 |
Set_Pool_Of_Subpool (Handle, Pool); |
| 40 |
Ptr := new (Handle) Rec'(I => <>); |
| 41 |
end; |