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,cd3da8c60e8be3be X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-07 20:00:18 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed-east.nntpserver.com!nntpserver.com!newsfeed2.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!59ce1190!not-for-mail Message-ID: <3D017333.25E98380@acm.org> From: Jeffrey Carter X-Mailer: Mozilla 4.7 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: What's wrong with this program? References: <070620021804210406%argreene@usanospam.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Sat, 08 Jun 2002 03:00:12 GMT NNTP-Posting-Host: 63.184.17.76 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 1023505212 63.184.17.76 (Fri, 07 Jun 2002 20:00:12 PDT) NNTP-Posting-Date: Fri, 07 Jun 2002 20:00:12 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:25491 Date: 2002-06-08T03:00:12+00:00 List-Id: Allison Greene wrote: > > procedure Test_Discriminant is > type Base is tagged null record; > > type Tower is new Base with > record > I : Integer; > end record; > > Instance: Tower (I => 5); > begin > null; > end Test_Discriminant; > > Result of compiling with GNAT: > > test_discriminant.adb:13:20: invalid constraint: type has no > discriminant The error message is quite clear: You are attempting to provide a discriminant constraint to a type that has no discriminant. The declaration type Tower (I : Integer) is record F : Float; end record; declares a type with a discriminant (I). You would declare an object of this type with Instance : Tower (I => 5); which is exactly the syntax you used. For your declaration of type Tower, this is illegal, since it does not have a discriminant. Perhaps what you wanted was Instance : Tower := (I => 5); which creates the object and initializes it with the value to the right of ":=". Since Tower is a record type, that value is a record aggregate. -- Jeff Carter "Your mother was a hamster and your father smelt of elderberries." Monty Python & the Holy Grail