comp.lang.ada
 help / color / mirror / Atom feed
From: radke@cpre1.ee.iastate.edu (Kevin Radke)
Subject: Is this legal Ada95?
Date: 1997/11/06
Date: 1997-11-06T00:00:00+00:00	[thread overview]
Message-ID: <63t88t$mqk$1@news.iastate.edu> (raw)


I was compiling some Ada83 code originally written under VMS
and the Dec Ada compiler, and Gnat v3.10p on NT gives me
the following error:

  foo.adb:11:56: object "Initial_Value" cannot be used before end
  of its declaration

This code has compiled successfully on 3 Ada83 compilers and
1 Ada95 compiler without problems.  (This doesn't mean it is
correct, just no one else has complained about it.)  I was
wondering if it is invalid somehow in Ada95 and the other
Ada95 compiler missed it, or if GNAT is being finicky.

Thanks!
Kevin

Here are the 3 files:
-- begin double_buffer.ads --
package Double_Buffer is

  generic
    type Item_Type is private;
    Initial_Value : in Item_Type;
  package Interface is
    procedure Put(Item : in     Item_Type);
    procedure Get(Item :    out Item_Type);
  end Interface;
end Double_Buffer;
-- end double_buffer.ads --

-- begin foo.ads --
generic
  type Item_Type is private;
  Initial_Value : in Item_Type;
package Foo is
  type Time_Tag_Type is new Integer;
  Null_Time_Tag : constant Time_Tag_Type := 0;

  procedure Bar (Item : in Item_Type);
end Foo;
-- end foo.ads --

-- begin foo.adb --
with Double_Buffer;

package body Foo is
  type Tagged_Item_Type is record
    Item     : Item_Type;
    Time_Tag : Time_Tag_Type;
  end record;

  package My_Buffer is new
    Double_Buffer.Interface (Tagged_Item_Type,
                             Initial_Value => (Item => Initial_Value,
                                               Time_Tag => Null_Time_Tag));
  procedure Bar (Item : in Item_Type) is
  begin
    null;
  end Bar;

end Foo;
-- end foo.adb --




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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-11-06  0:00 Kevin Radke [this message]
1997-11-06  0:00 ` Is this legal Ada95? 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