--  Generic subprograms declared in a subprogram and completed by an expression function or
--  as a null procedure: each instance takes the completion.
with Ada.Text_IO;
procedure Main is
   generic
      type Item is private;
   function Choose (C : Boolean; A, B : Item) return Item;
   function Choose (C : Boolean; A, B : Item) return Item is (if C then A else B);
   generic
      type Item is private;
   procedure Ignore (X : Item);
   procedure Ignore (X : Item) is null;
   generic
      type Item is private;
   function Same (X : Item) return Item with Post => Same'Result = X;
   function Same (X : Item) return Item is (X);
   function Pick is new Choose (Integer);
   procedure Ignore_Int is new Ignore (Integer);
   function Same_Int is new Same (Integer);
begin
   Ignore_Int (3);
   pragma Assert (Same_Int (4) = 4);
   Ada.Text_IO.Put_Line (Integer'Image (Pick (True, 1, 2)) & Integer'Image (Pick (False, 1, 2)) & Integer'Image (Same_Int (5)));
end Main;
