comp.lang.ada
 help / color / mirror / Atom feed
From: "David C. Hoos, Sr." <david.c.hoos.sr@ada95.com>
Subject: Re: Constraints?
Date: 1998/12/22
Date: 1998-12-22T00:00:00+00:00	[thread overview]
Message-ID: <75ntvd$bue$1@tsunami.traveller.com> (raw)
In-Reply-To: x7v7lvkk7f8.fsf@pogner.demon.co.uk


Simon Wright wrote in message ...
>(I think I forgot to post this one, it hasn't appeared here yet; if
>duplicated, sorry)
>
>GNAT thinks the code below is OK, Object Ada (special edition)
>doesn't.  If OA is right, as I fear it may be, can anyone offer a way
>of getting the effect I'm after?
>
>(t is some abstract base container, i is an abstract iterator over
>such a container, n is a concrete container, r is a concrete iterator
>over an n)
>
>package foo is
>    type t is abstract tagged null record;
>    type i (f : access t'class) is abstract tagged limited null record;
>    type n is new t with null record;
>    type r (f : access n) is new i (f) with null record;
>    -- OA says foo.ads: Error: line 5 col 37 LRM:3.7(15), Subtype of
>    -- discriminant must be statically compatible with subtype of the
>    -- corresponding parent discriminant
>end foo;
The real problem is a violation of LRM:3.7(13).
Both compilers will accept the code below.
package foo is
    type t is abstract tagged null record;
    type i (f : access t'class) is abstract tagged limited null record;
    type n is new t with null record;
    type a_n is access all n'class;
    type r (f : a_n) is new i (f) with null record;
end foo;


David C. Hoos, Sr.






  reply	other threads:[~1998-12-22  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-12-22  0:00 Constraints? Simon Wright
1998-12-22  0:00 ` David C. Hoos, Sr. [this message]
1998-12-25  0:00   ` Constraints? Simon Wright
1998-12-25  0:00     ` Constraints? dewar
1998-12-30  0:00   ` Constraints? Steve Todd
1998-12-23  0:00 ` Constraints? 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