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;


-- 
           Summary: Limited_Controlled exposes Adjust operation, which
                    should not exist.
           Product: gcc
           Version: 4.3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: prog at msobczak dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41845

Reply via email to