Ok, so I had to do this for a project when there were still some bugs in the GNAT implementation of Ada 2012… As I recall, my solution was something like this:
Task Type Whatever(Index : Positive) is --…
Type Handle is not null access Whatever;
Type Tasks is array(Positive range <>) of Handle;
Function Make_Tasks( Number : Natural ) return Tasks is
Count : Positive := 1;
Function Make return Handle is
Begin
Return Result : Constant Handle := new Whatever'(Index => Count) do
Count:= Positeve'Succ(Count);
End return;
End Make;
Begin
Return Result : Tasks:= (1..Number => Make);
End Make_Tasks;
Hope that helps.