comp.lang.ada
 help / color / mirror / Atom feed
* GNAT bug with overriding and Limited_Controlled?
@ 2009-10-26 21:49 Maciej Sobczak
  2009-10-27  0:12 ` Robert A Duff
  0 siblings, 1 reply; 3+ messages in thread
From: Maciej Sobczak @ 2009-10-26 21:49 UTC (permalink / 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



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

* Re: GNAT bug with overriding and Limited_Controlled?
  2009-10-26 21:49 GNAT bug with overriding and Limited_Controlled? Maciej Sobczak
@ 2009-10-27  0:12 ` Robert A Duff
  2009-10-27  9:15   ` Maciej Sobczak
  0 siblings, 1 reply; 3+ messages in thread
From: Robert A Duff @ 2009-10-27  0:12 UTC (permalink / raw)


Maciej Sobczak <see.my.homepage@gmail.com> writes:

> Is it a compiler bug?

Looks like it.

>...I think so, but if not, where is the original
> magic Adjust that the above code is apparently overriding?

Probably the one in s-finroo.ads.  But this Adjust is supposed to
be invisible to user's code.

- Bob



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

* Re: GNAT bug with overriding and Limited_Controlled?
  2009-10-27  0:12 ` Robert A Duff
@ 2009-10-27  9:15   ` Maciej Sobczak
  0 siblings, 0 replies; 3+ messages in thread
From: Maciej Sobczak @ 2009-10-27  9:15 UTC (permalink / raw)


On 27 Paź, 01:12, Robert A Duff <bobd...@shell01.TheWorld.com> wrote:

> > Is it a compiler bug?
>
> Looks like it.

Reported as #41845 in bugzilla.

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

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



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

end of thread, other threads:[~2009-10-27  9:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-26 21:49 GNAT bug with overriding and Limited_Controlled? Maciej Sobczak
2009-10-27  0:12 ` Robert A Duff
2009-10-27  9:15   ` Maciej Sobczak

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