comp.lang.ada
 help / color / mirror / Atom feed
From: "Martin Dowie" <martin.dowie@baesystems.com>
Subject: Re: Should this be legal?
Date: Thu, 22 Mar 2001 11:15:44 -0000
Date: 2001-03-22T11:15:44+00:00	[thread overview]
Message-ID: <3ab9dcf8$1@pull.gecm.com> (raw)
In-Reply-To: 99cjt2$v9g@newsserv.vs.dasa.de

ObjectAda 7.2 SE returns the following errors:
subtype_discriminant.ads: Error: line 15 col 13 LRM:3.9.2(13), a primitive
subprogram of a tagged type may not be declared after the type is frozen

subtype_discriminant.ads: Error: line 15 col 13 LRM:3.9.2(10), return
subtype does not statically match the first subtype of the tagged type

subtype_discriminant.ads: Error: line 17 col 33 LRM:3.2.2(4), Only a
subtype_mark is permitted in this context; no constraint is allowed,
ignoring constraint

subtype_discriminant.ads: Error: line 17 col 13 LRM:3.9.2(13), a primitive
subprogram of a tagged type may not be declared after the type is frozen


Oliver Kellogg <oliver.kellogg@vs.dasa.de> wrote in message
news:99cjt2$v9g@newsserv.vs.dasa.de...
> Hello Ada experts,
>
> The full declaration of the Derived type looks different than
> the partial view (Base_2 vs. Base(2))
>
> Should this be legal?
> Rational Apex 3.2.0b and GNAT 3.13p both accept it.
> (However, both compilers tend to have problems with this
> type of construction - especially in more complicated contexts.)
>
> But then, if Base_2 and Base(2) are supposedly interchangeable,
> how come the function Legal is accepted but function Illegal is
> refused ("constraint not allowed here") ?
>
> Thanks,
>
> Oliver M. Kellogg
>
>
> -- subtyped_discriminant.ads
>
> package Subtyped_Discriminant is
>
>    type Base (N : Integer) is tagged null record;
>
>    subtype Base_2 is Base (2);
>
>    type Derived is new Base_2 with private;
>
> private
>
>    type Derived is new Base (2) with null record;
>
>    -- However,
>
>    function Legal return Base_2;
>
>    function Illegal return Base (2);
>
> end Subtyped_Discriminant;
>
>
>
>





  reply	other threads:[~2001-03-22 11:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-22 10:13 Should this be legal? Oliver Kellogg
2001-03-22 11:15 ` Martin Dowie [this message]
2001-03-22 14:21   ` Oliver Kellogg
2001-03-22 16:29 ` Mark Lundquist
2001-03-22 16:51   ` Robert A Duff
replies disabled

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