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,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-22 02:34:05 PST Path: supernews.google.com!sn-xit-03!supernews.com!freenix!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!news.csl-gmbh.net!news1.dtag.de!newsserv.vs.dasa.de!news From: "Oliver Kellogg" Newsgroups: comp.lang.ada Subject: Should this be legal? Date: Thu, 22 Mar 2001 11:13:16 +0100 Organization: Daimler-Benz Aerospace Message-ID: <99cjt2$v9g@newsserv.vs.dasa.de> NNTP-Posting-Host: kellol.vs.dasa.de X-Newsreader: Microsoft Outlook Express 4.72.3155.0 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0 Xref: supernews.google.com comp.lang.ada:5988 Date: 2001-03-22T11:13:16+01:00 List-Id: 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;