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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2683e73445986fa2,start X-Google-Attributes: gid103376,public From: Matthew Heaney Subject: Derivation + Access Discriminant = Headaches Date: 1999/03/19 Message-ID: #1/1 X-Deja-AN: 456415544 Sender: matt@mheaney.ni.net NNTP-Posting-Date: Fri, 19 Mar 1999 00:31:57 PDT Newsgroups: comp.lang.ada Date: 1999-03-19T00:00:00+00:00 List-Id: Below is a tagged type hierarchy. The root is T. Type T has no discriminant. Type NT derives from T, and adds a discriminant that designates T'Class. Type NNT derives from NT, and wants to replace the inherited discriminant with a discriminant that designates NT'Class. My expectation is that this should be legal, because NT is in T'Class, and should therefore be allowed to replace the discriminant that designates T'Class. But when I try to compile NNT, my compiler is telling me the subtype of the discriminant is wrong: q.ads:5:14: subtype must be compatible with parent discriminant Is this a compiler bug? If not, what's the rationale for the restriction? Thanks, Matt --STX package P is type T is abstract tagged limited private; type NT (O : access T'Class) is abstract new T with private; private type T is abstract tagged limited null record; type NT (O : access T'Class) is new T with null record; end P; with P; use P; package Q is type NNT (O : access NT'Class) is new NT with private; private type NNT (O : access NT'Class) is new NT (O) with null record; end Q;