--  A type derived from a scalar type inherits the subprograms its parent's package declares
--  for it (RM 3.4(17)): an inherited `"-"` hides the predefined one, as the parent's does
--  (ACATS C74211A, where the predefined one was used), and an explicit one of the same
--  profile in the derived type's region overrides the inherited one.
with Ada.Text_IO;
procedure Main is
   package P is
      type T1 is range 1 .. 50;
      function "-" (L, R : T1) return T1;
      function Twice (X : T1) return T1;
   end P;
   package body P is
      function "-" (L, R : T1) return T1 is (3);
      function Twice (X : T1) return T1 is (if X <= 25 then X * 2 else 50);
   end P;
   use P;
   type T2 is new T1;
   package Q is
      type T3 is new T1;
      function Twice (X : T3) return T3;
   end Q;
   package body Q is
      function Twice (X : T3) return T3 is (X);
   end Q;
   use Q;
   A : constant T2 := 10;
   B : constant T3 := 10;
begin
   Ada.Text_IO.Put_Line (T2'Image (A - A) & T2'Image (Twice (A)) & T3'Image (Twice (B)));
end Main;
