* Subtype of limited type non-limited?
@ 2000-03-24 0:00 Florian Weimer
2000-03-24 0:00 ` Tucker Taft
0 siblings, 1 reply; 2+ messages in thread
From: Florian Weimer @ 2000-03-24 0:00 UTC (permalink / raw)
The following code results in a GNAT error message:
access_discriminant.ads:21:36: access discriminants allowed
only for limited types
GNAT assumes that the subtype of a limited type is non-limited (at
least under these special circumstances). Is this really correct?
with Ada.Streams;
package Access_Discriminant is
subtype Root_Stream_Type is Ada.Streams.Root_Stream_Type;
type Read_Write is new Root_Stream_Type with null record;
-- The following works:
-- type Read_Write is new Ada.Streams.Root_Stream_Type with null record;
procedure Read
(Stream : in out Read_Write;
Item : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset);
procedure Write
(Stream : in out Read_Write;
Item : in Ada.Streams.Stream_Element_Array);
type Message_Sender is null record;
type Mail_Body_Stream (Sender : access Message_Sender)
is new Read_Write with null record;
end Access_Discriminant;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Subtype of limited type non-limited?
2000-03-24 0:00 Subtype of limited type non-limited? Florian Weimer
@ 2000-03-24 0:00 ` Tucker Taft
0 siblings, 0 replies; 2+ messages in thread
From: Tucker Taft @ 2000-03-24 0:00 UTC (permalink / raw)
Florian Weimer wrote:
>
> The following code results in a GNAT error message:
>
> access_discriminant.ads:21:36: access discriminants allowed
> only for limited types
>
> GNAT assumes that the subtype of a limited type is non-limited (at
> least under these special circumstances). Is this really correct?
Nope, this looks like a bug. All subtypes and derivatives of a limited
type are limited, as are all types with a limited subcomponent.
This is sometimes summarized as "limited types are poison." ;-)
--
-Tucker Taft stt@averstar.com http://www.averstar.com/~stt/
Technical Director, Distributed IT Solutions (www.averstar.com/tools)
AverStar (formerly Intermetrics, Inc.) Burlington, MA USA
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2000-03-24 0:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-24 0:00 Subtype of limited type non-limited? Florian Weimer
2000-03-24 0:00 ` Tucker Taft
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox