comp.lang.ada
 help / color / mirror / Atom feed
* ADA 95/Gnat Problem?
@ 1996-04-11  0:00 R.J. Kirkbride
  1996-04-11  0:00 ` Robert Dewar
  0 siblings, 1 reply; 3+ messages in thread
From: R.J. Kirkbride @ 1996-04-11  0:00 UTC (permalink / raw)


Does anyone know why the code at the end produces the following error
message?

It works under an Ada 83 compiler fine so I am not sure whether this
is an Ada 95 issue or Gnat.

Any help would be greatly appreciated,

Rob.

GNU Ada version 2.7.2 (80386, BSD syntax) compiled by GNU C version
2.7.0.
enabled: -fpeephole -ffunction-cse -freg-struct-return -fcommon
-fgnu-linker
	 -m80387 -mhard-float -mno-soft-float -mno-386 -m486 -mieee-fp
	 -mfp-ret-in-387
bug.adb:14:08: expected private type "Set" defined at
generic_bounded_ordered_set.ads:9
bug.adb:14:08: found private type "Set" defined at
generic_bounded_ordered_set.ads:9

with Text_Io;
with Generic_Bounded_Ordered_Set;
procedure Bug is

  package Test_Bounded_Ordered_Set is new
    Generic_Bounded_Ordered_Set
    (Item => integer,
     The_Size => 10,
     Is_Equal => "=");


  type Selector is (X,Y);

  type Variant (The_Selector : Selector := X) is
     record
        case The_Selector is
           when X =>
              A_Set : Test_Bounded_Ordered_Set.Set;
           when Y =>
              null;
        end case;
     end record;


begin
   null;

end Bug;


generic

    type Item is private;
    The_Size : Positive;
    with function is_equal(l,r:item) return boolean is "=";

package Generic_Bounded_Ordered_Set is

    type Set is private;

    -- constructors
    procedure Clear (The_Set : in out Set);

    procedure Copy (From_The_Set : in Set; To_The_Set : out Set);

    procedure Add (Into_The_Set : in out Set; The_Item : in Item);

    procedure Insert (Into_The_Set : in out Set;
                      The_Item : in Item;
                      At_Position : in Positive);

    procedure Delete (From_The_Set : in out Set; At_Position : in
Positive);

    procedure Update (In_The_Set : in out Set;
                      At_Position : in Positive;
                      With_New_Value : in Item);

    -- selectors
    function The_Value_Of
                (In_The_Set : Set; At_Position : Positive) return
Item;

    function The_Position_Of
                (In_The_Set : Set; With_Value : Item) return Natural;

    function Is_Full (The_Set : Set) return Boolean;

    function Is_Empty (The_Set : Set) return Boolean;

    function Current_Count (Of_The_Set : Set) return Natural;

    -- iterators
    generic

        with procedure Process (The_Item : in Item; Continue : in out
Boolean);

    procedure Iterate (Over_The_Set : in Set);

    -- exception
    Generic_Bounded_Ordered_Set_Error : exception;

private
    -- Declared a new item below:-
    type An_Item is
        record
            This_Item : Item;
            Used : Boolean := false;
        end record;

    subtype set_index is Positive range 1 .. the_size;
        --
        --!!!!WARNING Ref 354.1 - Array with dynamic bounds
    type Set is array (set_index) of An_Item;

end Generic_Bounded_Ordered_Set;









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

end of thread, other threads:[~1996-04-12  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-04-11  0:00 ADA 95/Gnat Problem? R.J. Kirkbride
1996-04-11  0:00 ` Robert Dewar
1996-04-12  0:00   ` Richard Kenner

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