comp.lang.ada
 help / color / mirror / Atom feed
From: adam@irvine.com (Adam Beneschan)
Subject: Recursive tagged types
Date: 1997/11/07
Date: 1997-11-07T00:00:00+00:00	[thread overview]
Message-ID: <878950835.1236@dejanews.com> (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




             reply	other threads:[~1997-11-07  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-11-07  0:00 Adam Beneschan [this message]
1997-11-10  0:00 ` Recursive tagged types Stephen Leake
1997-11-10  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