comp.lang.ada
 help / color / mirror / Atom feed
From: Jeff Carter <jrcarter001@my-deja.com>
Subject: Re: Instantiating a generic formal procedure with an access procedure value
Date: 2000/01/05
Date: 2000-01-05T00:00:00+00:00	[thread overview]
Message-ID: <84u97t$uut$1@nnrp1.deja.com> (raw)
In-Reply-To: 38725A42.2961CEFC@averstar.com

In article <38725A42.2961CEFC@averstar.com>,
  Tucker Taft <stt@averstar.com> wrote:
> Your code compiles fine with My Favorite Front End.

I'm glad to hear that.

>
> This looks like a good old compiler bug.  On the other hand,
> it would still help if you included the complete source code,
> exactly as it was submitted to GNAT.  For example, I am surprised
> GNAT didn't complain about lack of a generic body.

Here's everything, copied and pasted from the actual files submitted to
GNAT:

package S_U is
   type Handle is limited private;

   procedure Op (Item : in out Handle; Element : in Integer);

   generic -- Iterate
      with procedure Action (Element : in out Integer; Continue : out
Boolean);
   procedure Iterate (Over : in out Handle);
private -- S_U
   type Handle is new Integer;
end S_U;

package body S_U is
   procedure Op (Item : in out Handle; Element : in Integer) is
   begin -- Op
      null;
   end Op;

   procedure Iterate (Over : in out Handle) is
      Continue : Boolean;
   begin -- Iterate
      Action (Element => Integer (Over), Continue => Continue);
   end Iterate;
end S_U;

with S_U;
package S is
   type Action_Ptr is access procedure (Element : in out Integer;
Continue : out Boolean);

   protected type Handle is
      procedure Op (Element : in Integer);
      procedure Iterate (Action : in Action_Ptr);
   private -- Handle
      Data : S_U.Handle;
   end Handle;
end S;

package body S is
   protected body Handle is
      procedure Op (Element : in Integer) is
      begin -- Op
         S_U.Op (Item => Data, Element => Element);
      end Op;

      procedure Iterate (Action : in Action_Ptr) is
         procedure Local is new S_U.Iterate (Action => Action.all);
      begin -- Iterate
         Local (Over => Data);
      end Iterate;
   end Handle;
end S;

I hope that helps.

--
Jeff Carter
"Now go away or I shall taunt you a second time."
-- Monty Python and the Holy Grail


Sent via Deja.com http://www.deja.com/
Before you buy.




  reply	other threads:[~2000-01-05  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-31  0:00 Instantiating a generic formal procedure with an access procedure value Jeff Carter
2000-01-03  0:00 ` Tucker Taft
2000-01-04  0:00   ` Jeff Carter
2000-01-04  0:00     ` Tucker Taft
2000-01-05  0:00       ` Jeff Carter [this message]
2000-01-05  0:00         ` Ed Falis
2000-01-12  0:00         ` Jeff Carter
2000-01-12  0:00           ` Simon Wright
2000-01-13  0:00             ` Jeff Carter
2000-01-13  0:00               ` Simon Wright
2000-01-13  0:00               ` Tucker Taft
2000-01-14  0:00                 ` Jeff Carter
replies disabled

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