comp.lang.ada
 help / color / mirror / Atom feed
* Recursive tagged types
@ 1997-11-07  0:00 Adam Beneschan
  1997-11-10  0:00 ` Stephen Leake
  0 siblings, 1 reply; 3+ messages in thread
From: Adam Beneschan @ 1997-11-07  0:00 UTC (permalink / raw)



GNAT outputs TRUE when I run this program.  Is this correct according
to the Ada rules?

                                -- thanks, Adam


with Ada.Tags;
with Text_IO;

procedure Test1 is

    Tag1 : Ada.Tags.Tag;
    Tag2 : Ada.Tags.Tag;

    procedure Recursive_Procedure (N : in Integer) is

        type Type1 is tagged null record;

        type Type2 is new Type1 with record
            Some_Data : Integer;
        end record;

    begin
        if N = 1 then
            Tag1 := Type2'Tag;
            Recursive_Procedure (2);
        else
            Tag2 := Type2'Tag;
        end if;
    end Recursive_Procedure;

begin
    Recursive_Procedure (1);
    Text_IO.Put_Line (Boolean'image (Ada.Tags."=" (Tag1, Tag2)));
end Test1;

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1997-11-10  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-11-07  0:00 Recursive tagged types Adam Beneschan
1997-11-10  0:00 ` Stephen Leake
1997-11-10  0:00   ` Tucker Taft

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