comp.lang.ada
 help / color / mirror / Atom feed
From: Adrian Hoe <abyhoe@gmail.com>
Subject: Type in allocator has deeper level than designated class-wide type
Date: Mon, 13 Jun 2011 08:31:43 -0700 (PDT)
Date: 2011-06-13T08:31:43-07:00	[thread overview]
Message-ID: <9bf2ef73-5cc7-4863-90d7-2e2cf3bcd294@o10g2000prn.googlegroups.com> (raw)

Hi all,

I have stomped into above error and I am stuck with the error and
runtime exception PROGRAM_ERROR : accessibility check failed.

Here's the fragment of my codes:


generic
   N : Positive;
   type Item is private;
package High_Cloud is

   package List renames Heterogeneous_Doubly_Link_List;
   use List;


   type Data_Array               is array ( 1 .. N ) of Item;

   type Element_Record           is new List.Node with private;
   type Series_Access            is new List.Access_List;

private

   type Element_Record is new List.Node with
      record
         Name           : Unbounded_String;
         Color          : Unbounded_String;
         Data           : Data_Array;
      end record;

...
end High_Cloud;

In the package body of High_Cloud, I have a procedure:


   procedure Add
      ( Cloud          : in out High_Cloud_Record;
        Name            : in     Unbounded_String;
        Color           : in     Unbounded_String;
        Data            : in     Data_Array )
   is

      New_Element : List.Access_Node;

   begin

      New_Element := new Element_Record'
<========== Error/Warning here.
                        ( Constructor.Init ( Name, Color, Data) ) ;

      Concatenate ( Cloud.Series, New_Element ) ;

   end Add;


My intention is to use genericity to create a data which is an array
(1..N) of any_type. This data is then stored in a list. Procedure Add
instantiate (by calling to Constructor.Init) the list's node with
data.

I have read the ARM 3.10.2 and 3.10.1 and also John Barnes book yet I
still have no clue how to solve the problem.

Can you please help? Thanks.
--
Adrian Hoe
http://adrianhoe.com/adrianhoe



             reply	other threads:[~2011-06-13 15:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-13 15:31 Adrian Hoe [this message]
2011-06-13 17:11 ` Type in allocator has deeper level than designated class-wide type Adam Beneschan
2011-06-14  0:49   ` Adrian Hoe
2011-06-14  1:08     ` Adam Beneschan
2011-06-14  1:11       ` Adrian Hoe
2011-06-14  1:07   ` Adrian Hoe
2011-06-14  1:24     ` Adam Beneschan
2011-06-14  6:04       ` Adrian Hoe
2011-06-14  8:01         ` Adrian Hoe
2011-06-14 16:01           ` Adam Beneschan
2011-06-15  2:04             ` Adrian Hoe
2011-06-15 15:44               ` Adam Beneschan
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox