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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no 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!h12g2000pro.googlegroups.com!not-for-mail From: Adrian Hoe Newsgroups: comp.lang.ada Subject: Re: Type in allocator has deeper level than designated class-wide type Date: Mon, 13 Jun 2011 18:07:26 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <9bf2ef73-5cc7-4863-90d7-2e2cf3bcd294@o10g2000prn.googlegroups.com> <92fb5bf2-f43e-4ac9-97eb-6092f10e5607@e17g2000prj.googlegroups.com> NNTP-Posting-Host: 110.159.15.203 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1308013646 17617 127.0.0.1 (14 Jun 2011 01:07:26 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 14 Jun 2011 01:07:26 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: h12g2000pro.googlegroups.com; posting-host=110.159.15.203; posting-account=coq9PAkAAAB2Xx46RZLFJw5dY9DVXW4- User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: HUARLECNK X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-us) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1,gzip(gfe) Xref: g2news2.google.com comp.lang.ada:20774 Date: 2011-06-13T18:07:26-07:00 List-Id: On Jun 14, 1:11=A0am, Adam Beneschan wrote: > 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 pr= ivate; > > =A0 =A0type Series_Access =A0 =A0 =A0 =A0 =A0 =A0is new List.Access_Lis= t; > > > 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_Stri= ng; > > =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 ( Na= me, 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". =A0But I don't have a guess about what Init is.) > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0-- Adam I changed the line in procedure Add from New_Element :=3D new Element_Record' ( Constructor.Init ( Name, Color, Data) ) ; to New_Element :=3D new Element_Record; The compiler is still pointing the same warning to this line. What exactly does the warning message "Type in allocator has deeper level than designated class-wide type" mean? Is the compiler unable to determine the size of the array during allocation? Or the array is a level deeper than the List.Access_Node? Thanks. -- Adrian Hoe http://adrianhoe.com/adrianhoe