comp.lang.ada
 help / color / mirror / Atom feed
* Another small discrepancy between compilers
@ 2004-03-16 14:05 Lionel.DRAGHI
  0 siblings, 0 replies; only message in thread
From: Lionel.DRAGHI @ 2004-03-16 14:05 UTC (permalink / raw)
  To: comp.lang.ada

Here is another small difference between GNAT and ObjectAda.
It's not important at all, I am just curious about wich one is right.

GNAT seems to be wrong accepting to compile it, what do you think about it?

TIA

-- 
Lionel.


with Ada.Text_IO; use Ada.Text_IO;
with Ada.Tags;

procedure Bug is
   type T_Event is abstract tagged null record;
   type T_New_Event is new T_Event with null record;

   function Get return T_Event'Class is
      Tmp : T_New_Event;
   begin
      return Tmp;
   end Get;
   
   Msg : constant T_Event'Class := Get;

begin
   Put_Line (Ada.Tags.Expanded_Name (T_Event       (Msg)'Tag)); -- 1 
   Put_Line (Ada.Tags.Expanded_Name (T_Event'Class (Msg)'Tag)); -- 2
   Put_Line (Ada.Tags.Expanded_Name (Msg'Tag));                 -- 3

   -- 1 : OK for GNAT 3.16a (20030120)
   --     KO for ObjectAda (tm) Version 7.2.1 :
   --     *****Error: LRM:3.9(13) & 3.9(17) The prefix to 'TAG must be a
tagged subtype
   --     *****        or an object or value of a classwide tagged type,
Continuing
   
   -- 2 : OK for GNAT 3.16a (20030120) but with a warning 
   --     "Useless conversion, "Msg" has this type" 
   --     before the code simplification.
   --     OK for ObjectAda (tm) Version 7.2.1

   -- 3 : what this code should always have been! compile with both.

end Bug;




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-03-16 14:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-16 14:05 Another small discrepancy between compilers Lionel.DRAGHI

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