comp.lang.ada
 help / color / mirror / Atom feed
From: "Mark Lundquist" <no.spam@getalife.com>
Subject: Who is wrong, me or GNAT? :-)
Date: Sat, 22 Dec 2001 19:20:40 GMT
Date: 2001-12-22T19:20:40+00:00	[thread overview]
Message-ID: <c25V7.2353$8L1.26553@rwcrnsc52> (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






             reply	other threads:[~2001-12-22 19:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-22 19:20 Mark Lundquist [this message]
2001-12-22 19:28 ` Who is wrong, me or GNAT? :-) Ed Falis
2001-12-22 21:14   ` Mark Lundquist
2001-12-27 15:39 ` Matthew Heaney
replies disabled

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