From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9dcaa9f073e2ef8f X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!e17g2000prj.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Type in allocator has deeper level than designated class-wide type Date: Mon, 13 Jun 2011 10:11:33 -0700 (PDT) Organization: http://groups.google.com Message-ID: <92fb5bf2-f43e-4ac9-97eb-6092f10e5607@e17g2000prj.googlegroups.com> References: <9bf2ef73-5cc7-4863-90d7-2e2cf3bcd294@o10g2000prn.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1307985093 25201 127.0.0.1 (13 Jun 2011 17:11:33 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 13 Jun 2011 17:11:33 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: e17g2000prj.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: ARLUEHNKC X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:20771 Date: 2011-06-13T10:11:33-07:00 List-Id: On Jun 13, 8:31=A0am, Adrian Hoe wrote: > 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 > =A0 =A0N : Positive; > =A0 =A0type Item is private; > package High_Cloud is > > =A0 =A0package List renames Heterogeneous_Doubly_Link_List; > =A0 =A0use List; > > =A0 =A0type Data_Array =A0 =A0 =A0 =A0 =A0 =A0 =A0 is array ( 1 .. N ) of= Item; > > =A0 =A0type Element_Record =A0 =A0 =A0 =A0 =A0 is new List.Node with priv= ate; > =A0 =A0type Series_Access =A0 =A0 =A0 =A0 =A0 =A0is new List.Access_List; > > private > > =A0 =A0type Element_Record is new List.Node with > =A0 =A0 =A0 record > =A0 =A0 =A0 =A0 =A0Name =A0 =A0 =A0 =A0 =A0 : Unbounded_String; > =A0 =A0 =A0 =A0 =A0Color =A0 =A0 =A0 =A0 =A0: Unbounded_String; > =A0 =A0 =A0 =A0 =A0Data =A0 =A0 =A0 =A0 =A0 : Data_Array; > =A0 =A0 =A0 end record; > > ... > end High_Cloud; > > In the package body of High_Cloud, I have a procedure: > > =A0 =A0procedure Add > =A0 =A0 =A0 ( Cloud =A0 =A0 =A0 =A0 =A0: in out High_Cloud_Record; > =A0 =A0 =A0 =A0 Name =A0 =A0 =A0 =A0 =A0 =A0: in =A0 =A0 Unbounded_String= ; > =A0 =A0 =A0 =A0 Color =A0 =A0 =A0 =A0 =A0 : in =A0 =A0 Unbounded_String; > =A0 =A0 =A0 =A0 Data =A0 =A0 =A0 =A0 =A0 =A0: in =A0 =A0 Data_Array ) > =A0 =A0is > > =A0 =A0 =A0 New_Element : List.Access_Node; > > =A0 =A0begin > > =A0 =A0 =A0 New_Element :=3D new Element_Record' > <=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Error/Warning here. > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ( Constructor.Init ( Name= , Color, Data) ) ; > > =A0 =A0 =A0 Concatenate ( Cloud.Series, New_Element ) ; > > =A0 =A0end 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. I think we need to see the definition of Constructor.Init, at least. (I'm guessing that Heterogeneous_Doubly_Link_List is a library package that defines Node as a tagged record and Access_Node as "access all Node'Class". But I don't have a guess about what Init is.) -- Adam