comp.lang.ada
 help / color / mirror / Atom feed
From: "Matthew Heaney" <matthew_heaney@acm.org>
Subject: generic formal derived type that inherits private op
Date: 1999/11/11
Date: 1999-11-11T00:00:00+00:00	[thread overview]
Message-ID: <382b8c0b_1@news1.prserv.net> (raw)

There's some code below that I think should work, but doesn't:

1) A generic child package imports a generic formal type that derives
from a (tagged) type declared in the parent package.

2) The parent type declares a primitive operation privately; that is, in
the private region of the parent package.

3) The generic child package tries to call the (private) primitive
operation of the derived type, but the compiler doesn't think the
derived type comes with that operation.  This appears to be incorrect.

Here's the output of my compiler (GNAT v3.12p):

p-c.adb:5:19: expected type access to "T" defined at p.ads:9
p-c.adb:5:19: found type access to "Nt" defined at p-c.ads:5


What's the scoop?  Is this correct or not?

(Tucker: I submitted this same code to CLA a few months ago.  Remember
we talked about it at the ARG meeting a few weeks ago?)

Thanks,
Matt


--STX
package P is

   type T is abstract tagged limited private;

private

   type T is abstract tagged limited null record;

   procedure Private_Op (O : access T);

end P;

package body P is

   procedure Private_Op (O : access T) is
   begin
      null;
   end;

end P;


generic
   type NT is new T with private;
package P.C is

   procedure Op (O : access NT);

end P.C;


package body P.C is

   procedure Op (O : access NT) is
   begin
      Private_Op (O);
   end Op;

end P.C;




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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-11  0:00 Matthew Heaney [this message]
1999-11-12  0:00 ` generic formal derived type that inherits private op 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