comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@bix.com (Tom Moran)
Subject: record rep on tagged record question
Date: 1997/09/23
Date: 1997-09-23T00:00:00+00:00	[thread overview]
Message-ID: <3428278b.18967041@SantaClara01.news.InterNex.Net> (raw)


Shouldn't this be legal Ada 95?  One of the three compilers I tried
gives a "raised CONSTRAINT_ERROR" when I try to execute it.  The
message apparently comes from the attempt to elaborate
"Picture:b.Child_Type", since neither the Ada.Text_IO in the main
program nor the one in its exception handler produces any result.
(The other two compilers both give "hi" results.)  I've checked and
Tag'Size for this compiler is 32, so an offset of 4 bytes seems
appropriate.  If I set TAG_SIZE to zero, the compiler complains that
I'm trying to overlay the tag. If I eliminate the 'for Root_Type use
record' rep clause entirely, I get "hi".
 
package b is

    TAG_SIZE : constant := 4;

    type Root_Type is tagged record
        I : Integer;
    end record;
    for Root_Type use record
        I at TAG_SIZE range 0 .. 31;
    end record;


    type Child_Type is new Root_Type with record
        J : Integer;
    end record;

end b;

with ada.exceptions;
with ada.text_io;
with b;
procedure try is
  Picture : b.Child_Type;
begin
  ada.text_io.put_line("hi");
exception
  when oops:others =>
    ada.text_io.put_line("oops:"
      & ada.exceptions.exception_information(oops));
end try;





             reply	other threads:[~1997-09-23  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-09-23  0:00 Tom Moran [this message]
1997-09-24  0:00 ` record rep on tagged record question Matthew Heaney
  -- strict thread matches above, loose matches on Subject: below --
1997-10-01  0:00 tmoran
1997-10-01  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