Bug 41845

Summary: Limited_Controlled exposes Adjust operation, which should not exist.
Product: gcc Reporter: Maciej Sobczak <prog>
Component: adaAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal CC: ebotcazou, gcc-bugs
Priority: P3    
Version: 4.3.4   
Target Milestone: 4.8.0   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed:

Description Maciej Sobczak 2009-10-27 09:12:02 UTC
The following should not compile, since the Limited_Controlled has no Adjust operation and the test code uses the "overriding" keyword, which is supposed to catch the attempt to override non-existing operation. Other operation names are detected properly, which indicates that there is some "hidden" Adjust operation that should not be visible to the user code. Hint from comp.lang.ada: this hidden operation is in s-finroo.ads.

Test code that should not compile, but is accepted by GNAT:

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;
Comment 1 Eric Botcazou 2015-12-05 17:58:38 UTC
test.adb:14:07: subprogram "Adjust" is not overriding