comp.lang.ada
 help / color / mirror / Atom feed
From: adam@irvine.com (Adam Beneschan)
Subject: Re: which compiler is right?
Date: 17 Mar 2004 09:27:32 -0800
Date: 2004-03-17T09:27:32-08:00	[thread overview]
Message-ID: <b4682ab7.0403170927.cc800a5@posting.google.com> (raw)
In-Reply-To: mailman.97.1079444714.327.comp.lang.ada@ada-france.org

Lionel.DRAGHI@fr.thalesgroup.com wrote in message news:<mailman.97.1079444714.327.comp.lang.ada@ada-france.org>...
> 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



  parent reply	other threads:[~2004-03-17 17:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-16 13:44 which compiler is right? Lionel.DRAGHI
2004-03-16 14:56 ` Dmitry A. Kazakov
2004-03-16 23:43 ` Randy Brukardt
2004-03-17 17:27 ` Adam Beneschan [this message]
2004-03-18  5:07   ` Randy Brukardt
2004-03-18 20:33     ` Adam Beneschan
2004-03-19 19:48       ` Randy Brukardt
  -- strict thread matches above, loose matches on Subject: below --
2004-03-17 18:56 Lionel.DRAGHI
2004-03-17 18:53 Lionel.DRAGHI
2004-03-18  4:57 ` Randy Brukardt
2004-03-17 10:16 Lionel.DRAGHI
2004-03-17 17:48 ` Randy Brukardt
2004-03-16 15:35 Lionel.DRAGHI
1997-07-24  0:00 Which compiler is right ? Strategies
1997-07-25  0:00 ` Albert K. Lee
1997-07-25  0:00 ` Tucker Taft
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox