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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3e5f85a85cdab16e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-22 03:24:05 PST From: "Martin Dowie" Newsgroups: comp.lang.ada References: <99cjt2$v9g@newsserv.vs.dasa.de> Subject: Re: Should this be legal? Date: Thu, 22 Mar 2001 11:15:44 -0000 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 NNTP-Posting-Host: sg2c11210.dsge.edinbr.gmav.gecm.com Message-ID: <3ab9dcf8$1@pull.gecm.com> X-Trace: 22 Mar 2001 11:07:36 GMT, sg2c11210.dsge.edinbr.gmav.gecm.com Path: supernews.google.com!sn-xit-03!supernews.com!freenix!fr.clara.net!heighliner.fr.clara.net!diablo.netcom.net.uk!netcom.net.uk!easynet-monga!easynet-melon!easynet.net!btnet-feed5!btnet!newreader.ukcore.bt.net!pull.gecm.com!sg2c11210.dsge.edinbr.gmav.gecm.com Xref: supernews.google.com comp.lang.ada:5989 Date: 2001-03-22T11:15:44+00:00 List-Id: 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 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; > > > >