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,814577151c84863d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-03-17 09:27:33 PST Path: archiver1.google.com!postnews2.google.com!not-for-mail From: adam@irvine.com (Adam Beneschan) Newsgroups: comp.lang.ada Subject: Re: which compiler is right? Date: 17 Mar 2004 09:27:32 -0800 Organization: http://groups.google.com Message-ID: References: NNTP-Posting-Host: 66.126.103.122 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1079544453 27087 127.0.0.1 (17 Mar 2004 17:27:33 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 17 Mar 2004 17:27:33 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:6377 Date: 2004-03-17T09:27:32-08:00 List-Id: Lionel.DRAGHI@fr.thalesgroup.com wrote in message news:... > Could someone, please, tell me if this code compile with other compilers > than GNAT and ObjectAda? > Or even better, is ObjectAda right in rejecting it? > > Thanks in advance > > -- > Lionel Draghi > > > -- --------------------------------------------------------------- > package Pkg1 is > > type T_Event is abstract tagged null record; > > function Priority (Event : T_Event) return Natural is abstract; > > end Pkg1; > > -- --------------------------------------------------------------- > with Pkg1; > > generic > type T_Event (<>) is new Pkg1.T_Event with private; > > package Pkg2 is > function Priority (Event : in T_Event) return Natural; > > -- OK for GNAT 3.16a (20030120) > -- KO for ObjectAda (tm) Version 7.2.1 : > -- > -- 7 function Priority (Event : in T_Event) return Natural; > -- * > -- *****Error: LRM:3.9.2(13) a primitive subprogram of a tagged type may > not be > -- ***** declared after the type is frozen > > end Pkg2; Since the score is currently 2-0 that the code should be illegal, maybe I should point out that not everyone agrees with this analysis, before you decide it's necessary to fix your code. My belief is that since the Priority routine declared in Pkg2 is declared in a different scope than whatever type will be used to instantiate Pkg2, Priority is neither a primitive subprogram nor is overriding. I think GNAT is correct to accept the code. -- Adam