comp.lang.ada
 help / color / mirror / Atom feed
* Who is wrong, me or GNAT? :-)
@ 2001-12-22 19:20 Mark Lundquist
  2001-12-22 19:28 ` Ed Falis
  2001-12-27 15:39 ` Matthew Heaney
  0 siblings, 2 replies; 4+ messages in thread
From: Mark Lundquist @ 2001-12-22 19:20 UTC (permalink / raw)



OK, here's the code:

--------------------------------------------
-- foo.adb
--------------------------------------------

 procedure Foo is

  package P is
   type T is abstract tagged null record;
   function Create return T is abstract;
  end P;


  package P1 is
   type T2 is new P.T with private;
  private
   type T1 is new P.T with null record;
   function Create return T1;

   type T2 is new T1 with null record;
   --
   -- Gnat takes error on this ^^^ line.
   --
   -- But T2 should inherit 'Create' from
   -- (concrete) type T1.

  end P1;

  package body P1 is
   function Create return T1 is
   begin
    return (null record);
   end Create;
  end P1;

 begin
  null;
 end Foo;
----------------------------------------

GNAT 3.13(p) says:
foo.adb:16:30: type must be declared abstract or "Create" overridden

Is this a bug in GNAT?  If not, what am I missing?

I was trying to come up with an idiom for inherited constructors for
descendants of an abstract tagged type, and this seemed like it ought to do
the trick (although it suffers from the fact that the intermediate derived
type, e.g. T1 in this case, would have to override all the abstract
primitives).

Any help appreciated...
thx
-- mark






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

end of thread, other threads:[~2001-12-27 15:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-22 19:20 Who is wrong, me or GNAT? :-) Mark Lundquist
2001-12-22 19:28 ` Ed Falis
2001-12-22 21:14   ` Mark Lundquist
2001-12-27 15:39 ` Matthew Heaney

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