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.6 required=5.0 tests=BAYES_05,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6742ab01b9814abe X-Google-Attributes: gid103376,public From: ncohen@watson.ibm.com (Norman H. Cohen) Subject: Re: type casting tagged types in the wrong direction Date: 1996/03/28 Message-ID: <4je8f8$174r@watnews1.watson.ibm.com>#1/1 X-Deja-AN: 144676104 distribution: world references: <3159B860.28A6@csehp3.mdc.com> organization: IBM T.J. Watson Research Center reply-to: ncohen@watson.ibm.com newsgroups: comp.lang.ada Date: 1996-03-28T00:00:00+00:00 List-Id: In article <3159B860.28A6@csehp3.mdc.com>, "James A. Squire" 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