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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,98e3ee7e73b9dd89 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!g47g2000cwa.googlegroups.com!not-for-mail From: nblanpain@hotmail.com Newsgroups: comp.lang.ada Subject: Re: Aliased Date: 16 Jun 2005 07:03:09 -0700 Organization: http://groups.google.com Message-ID: <1118930589.514028.150340@g47g2000cwa.googlegroups.com> References: <1118851601.345326.86640@g49g2000cwa.googlegroups.com> NNTP-Posting-Host: 62.212.119.91 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1118930594 27160 127.0.0.1 (16 Jun 2005 14:03:14 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 16 Jun 2005 14:03:14 +0000 (UTC) User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: g47g2000cwa.googlegroups.com; posting-host=62.212.119.91; posting-account=_RMqsA0AAAC-PdbSlgs9JBFgDjKtbmJX Xref: g2news1.google.com comp.lang.ada:11419 Date: 2005-06-16T07:03:09-07:00 List-Id: So this is my sources and the compilation error : ------ Container.ads generic type T_Item is private; Static_Size : Integer; package Container is type T_Array is array (Integer range <>) of T_Item; type A_Array is access all T_Array; type T_Container is tagged record Obj_Array : aliased T_Array (1..Static_Size); Ptr_Array : A_Array; end record; procedure Initialize (This : in out T_Container; Dynamic_Size : in Integer); function P_Array (This : in T_Container) return A_Array; end Container; ------ Container.adb package body Container is procedure Initialize (This : in out T_Container; Dynamic_Size : in Integer) is begin if Dynamic_Size /= 0 then This.Ptr_Array := new T_Array (1.. Dynamic_Size); elsif Static_Size /= 0 then This.Ptr_Array := This.Obj_Array'Access; --- Compilation Error end if; end Initialize; function P_Array (This : in T_Container) return A_Array is begin return This.Ptr_Array; end P_Array; end Container; -- Compilation Error : Object subtype must statically match designated subtype. No local pointer cannot point to local object. I have tried to solve this problem using Unchecked_Access or To_Pointer of System. I have found no solution. Have you a solution to my problem? Thanks,