From: Matthew Heaney <matthew_heaney@acm.org>
Subject: Derivation + Access Discriminant = Headaches
Date: 1999/03/19
Date: 1999-03-19T00:00:00+00:00 [thread overview]
Message-ID: <m3r9qlvpuv.fsf@mheaney.ni.net> (raw)
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;
next reply other threads:[~1999-03-19 0:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-03-19 0:00 Matthew Heaney [this message]
1999-03-19 0:00 ` Derivation + Access Discriminant = Headaches Richard D Riehle
1999-03-19 0:00 ` Matthew Heaney
1999-03-19 0:00 ` Stephen Leake
1999-03-20 0:00 ` Richard D Riehle
1999-03-20 0:00 ` Nick Roberts
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox