comp.lang.ada
 help / color / mirror / Atom feed
From: ncohen@watson.ibm.com (Norman H. Cohen)
Subject: Re: type casting tagged types in the wrong direction
Date: 1996/03/28
Date: 1996-03-28T00:00:00+00:00	[thread overview]
Message-ID: <4je8f8$174r@watnews1.watson.ibm.com> (raw)
In-Reply-To: 3159B860.28A6@csehp3.mdc.com

In article <3159B860.28A6@csehp3.mdc.com>, "James A. Squire"
<m193884@CSEHP3.MDC.COM> writes: 

|> Say I have something like: 
|>
|> type A is tagged
|>   record
|>     X : ABC;
|>     Y : DEF;
|>   end record;
|>
|> type B is new A with
|>   record
|>     W : GHI;
|>   end record;
|>
|> type C is new B with
|>   record
|>     Z : JKL;
|>   end record;
|>
|>
|> OK.  Now, let's say that I forgot which type extends off of which, and I
|> write a statement like this: 
|>
|>   Jim  : C;
|>   Jane : B;
|>   Save : JKL;
|>
|> begin
|>   ...
|>   Jim := C (Jane);
|>   Save := Jim.Z;
|>   ...
|> end;
|>
|> GNAT 3.03 compiles this statement.  Is that really right?  Is Jim.Z
|> defined?

The expression Jim.Z is perfectly legal, but the type conversion C(Jane)
is not.  This should be flagged as a compile-time error, because it does
not satisfy the conditions in either 4.6(22) or 4.6(23).

--
Norman H. Cohen    ncohen@watson.ibm.com




  reply	other threads:[~1996-03-28  0:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-03-27  0:00 type casting tagged types in the wrong direction James A. Squire
1996-03-28  0:00 ` Norman H. Cohen [this message]
1996-03-28  0:00   ` Robert Dewar
1996-03-28  0:00 ` Tucker Taft
1996-03-28  0:00   ` Robert Dewar
1996-03-30  0:00     ` Fergus Henderson
1996-03-31  0:00       ` Robert Dewar
1996-03-29  0:00   ` type casting tagged types in the wrong Scott Moody
     [not found] <md5:5AA0EAFF641BB9F461162E7F13E1101F>
1996-03-29  0:00 ` type casting tagged types in the wrong direction James A. Squire
1996-03-29  0:00   ` Robert Dewar
replies disabled

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