comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam@spam.com>
Subject: Re: Aliased
Date: Fri, 17 Jun 2005 02:15:04 GMT
Date: 2005-06-17T02:15:04+00:00	[thread overview]
Message-ID: <Imqse.5650$NX4.3524@newsread1.news.pas.earthlink.net> (raw)
In-Reply-To: <1118930589.514028.150340@g47g2000cwa.googlegroups.com>

nblanpain@hotmail.com wrote:
> 
> ------ 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;

>         This.Ptr_Array := This.Obj_Array'Access; --- Compilation Error
> 
> -- Compilation Error : Object subtype must statically match designated
> subtype. No local pointer cannot point to local object.

A_Array designates an unconstrained array type, T_Array. This.Obj_Array 
is a component of a constrained subtype of T_Array. 
This.Obj_Array'access does not designate the same subtype as A_Array. 
That's why this is illegal.

Change your type declaration to

type T_Array is array (1 .. Static_Size) of T_Item;

and this should work.

-- 
Jeff Carter
"I blow my nose on you."
Monty Python & the Holy Grail
03



  parent reply	other threads:[~2005-06-17  2:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-15 16:06 Aliased nblanpain
2005-06-15 16:35 ` Aliased Martin Dowie
2005-06-15 18:56 ` Aliased nblanpain
2005-06-15 21:47   ` Aliased Martin Dowie
2005-06-16  3:15 ` Aliased Steve
2005-06-16 14:03   ` Aliased nblanpain
2005-06-16 19:56     ` Aliased Simon Wright
2005-06-17  7:01       ` Aliased nblanpain
2005-06-17  9:38         ` Aliased Larry Kilgallen
2005-06-19 19:44           ` Aliased nblanpain
2005-06-19 20:33             ` Aliased Jeffrey Carter
2005-06-20  9:34               ` Aliased nblanpain
2005-06-20 16:41                 ` Aliased Jeffrey Carter
2005-06-17  2:15     ` Jeffrey Carter [this message]
2005-06-17  7:02       ` Aliased nblanpain
2005-06-17  2:35     ` Aliased Steve
2005-06-17  7:52       ` Aliased Dmitry A. Kazakov
2005-06-17  4:38     ` Aliased Christoph Grein
2005-06-29 21:10     ` Aliased Robert A Duff
replies disabled

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