comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <see.my.homepage@gmail.com>
Subject: GNAT bug with overriding and Limited_Controlled?
Date: Mon, 26 Oct 2009 14:49:42 -0700 (PDT)
Date: 2009-10-26T14:49:42-07:00	[thread overview]
Message-ID: <3335118d-85bd-40f5-8a7a-4cff74ffb269@j19g2000yqk.googlegroups.com> (raw)

While chasing some strange bug[*] I have stomped onto something
interesting:

with Ada.Finalization;

procedure Test is

   package P is

      type T is new Ada.Finalization.Limited_Controlled
        with null record;

      overriding
      procedure Initialize (X : in out T);

      overriding
      procedure Adjust (X : in out T);

      overriding
      procedure Finalize (X : in out T);

   end P;

   package body P is
      procedure Initialize (X : in out T) is
      begin
         null;
      end Initialize;

      procedure Adjust (X : in out T) is
      begin
         null;
      end Adjust;

      procedure Finalize (X : in out T) is
      begin
         null;
      end Finalize;
   end P;

begin
   null;
end Test;

As far as I understand, the Ada.Finalization.Limited_Controlled type
has no Adjust operation. Therefore, the T type cannot override it. Yet
the above is happily accepted by GNAT GPL 2009 (20090519).

As an exercise try to misspell the operation name as a sanity check
that the overriding keyword is recognized at all.

Is it a compiler bug? I think so, but if not, where is the original
magic Adjust that the above code is apparently overriding?

--
Maciej Sobczak * www.msobczak.com * www.inspirel.com

Database Access Library for Ada: www.inspirel.com/soci-ada



             reply	other threads:[~2009-10-26 21:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-26 21:49 Maciej Sobczak [this message]
2009-10-27  0:12 ` GNAT bug with overriding and Limited_Controlled? Robert A Duff
2009-10-27  9:15   ` Maciej Sobczak
replies disabled

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