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,381b38831db17ac9 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-22 11:31:19 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed2.news.rcn.net!rcn!chnws02.mediaone.net!chnws06.ne.mediaone.net!65.96.0.182!typhoon.ne.mediaone.net.POSTED!not-for-mail Message-ID: <3C24DF92.7040205@mediaone.net> From: Ed Falis User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.6) Gecko/20011213 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Who is wrong, me or GNAT? :-) References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Sat, 22 Dec 2001 19:28:27 GMT NNTP-Posting-Host: 24.60.18.249 X-Complaints-To: abuse@mediaone.net X-Trace: typhoon.ne.mediaone.net 1009049307 24.60.18.249 (Sat, 22 Dec 2001 14:28:27 EST) NNTP-Posting-Date: Sat, 22 Dec 2001 14:28:27 EST Organization: ATT Broadband Xref: archiver1.google.com comp.lang.ada:18249 Date: 2001-12-22T19:28:27+00:00 List-Id: Mark Lundquist wrote: > OK, here's the code: > > -------------------------------------------- > -- foo.adb > -------------------------------------------- > > procedure Foo is > > package P is > type T is abstract tagged null record; > function Create return T is abstract; > end P; > > > package P1 is > type T2 is new P.T with private; > private > type T1 is new P.T with null record; > function Create return T1; > > type T2 is new T1 with null record; > -- > -- Gnat takes error on this ^^^ line. > -- > -- But T2 should inherit 'Create' from > -- (concrete) type T1. > > end P1; > > package body P1 is > function Create return T1 is > begin > return (null record); > end Create; > end P1; > > begin > null; > end Foo; > ---------------------------------------- > > GNAT 3.13(p) says: > foo.adb:16:30: type must be declared abstract or "Create" overridden > > Is this a bug in GNAT? If not, what am I missing? > > I was trying to come up with an idiom for inherited constructors for > descendants of an abstract tagged type, and this seemed like it ought to do > the trick (although it suffers from the fact that the intermediate derived > type, e.g. T1 in this case, would have to override all the abstract > primitives). > > Any help appreciated... > thx > -- mark RM 3.9.3 (4-6) Functions with a controlling result must be explicitly overridden when the parent type is derived (or the derived type has to be declared abstract), as they're considered abstract in the derived type.