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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.36.3.195 with SMTP id e186mr8085711ite.36.1508840034014; Tue, 24 Oct 2017 03:13:54 -0700 (PDT) X-Received: by 10.157.15.247 with SMTP id m52mr593016otd.1.1508840033988; Tue, 24 Oct 2017 03:13:53 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.am4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!k70no4751683itk.0!news-out.google.com!p6ni90itp.0!nntp.google.com!l196no4736772itl.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 24 Oct 2017 03:13:53 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=212.45.154.1; posting-account=fEeJQAoAAABLcKAvkveW1ca-ReZJoaMK NNTP-Posting-Host: 212.45.154.1 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <2be64a8b-5f89-414c-9dcd-433bd5d855a0@googlegroups.com> Subject: Re: Alleged GNAT bug From: "A. Cervetti" Injection-Date: Tue, 24 Oct 2017 10:13:54 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Body-CRC: 2919825061 X-Received-Bytes: 2658 Xref: news.eternal-september.org comp.lang.ada:48578 Date: 2017-10-24T03:13:53-07:00 List-Id: > > I state that a legal program fails with a compiler error message. > > But please confirm if my program (see above URL) is really legal. Maybe I > mistake? No, it is not. The reason is not obvious and a little convoluted (like your program too) and depend upon the freezing rules (arm 13.14) Anyway the reference to System.ads in the error message is misleading. In the generic package With_Finalization you derive the type Derived from the formal Base type. Derived is a record extension (although null) of the base type. This means that, when you instantiate the package the actual Term_Type_Without_Finalize is frozen (13.14.7). The compiler tries to create a dispatch table for the primitive operation of the type. Get_Literal is a primitive operation so it is frozen too (13.14.15 1/3) but the return type Term_Literal_Value is still incomplete (7.3.5) The ARM is not explicit about this (as far as I know, any language lawyer out there?) but the reason of the error is as I said. To avoid the error you should instantiate the package Finalizer after the completion of Term_Literal_Value. if you need visibility of Term_Type you can declare it as private too. .... type Term_Type is private; private type Term_Literal_Value is null record; package Finalizer is new Term_Handled_Record.With_Finalization(Term_Type_Without_Finalize); type Term_Type is new Finalizer.Derived with null record; .... This works. A.