--  A subtype whose bounds are known only at run time (ACATS C35503O, C43205A, C43214E):
--  'First, 'Last and 'Width are its bounds' (they were 0), a value going to it is checked
--  against them, a positional aggregate of an array whose index subtype's first value is
--  known only at run time starts there (it started at Integer'First), and an array going
--  to a constrained subtype with run-time bounds slides into them.
with Ada.Text_IO;
procedure Main is
   function Id (X : Integer) return Integer is (X);
   subtype Small is Integer range Id (-10) .. Id (10);
   subtype Upper is Character range Character'Val (Id (65)) .. 'Z';
   type Color is (Red, Green, Blue, Yellow);
   function Ident (C : Color) return Color is (C);
   subtype Warm is Color range Ident (Red) .. Ident (Green);
   subtype Low_Static is Integer range 11 .. Id (12);
   type Vec is array (Low_Static range <>) of Integer;
   subtype High_Static is Integer range Id (21) .. 30;
   type Wec is array (High_Static range <>) of Integer;
   subtype Three is String (Id (5) .. 7);
   X : Small := 5;
   Count : Natural := 0;
   procedure Show_Vec (A : Vec) is
   begin
      Ada.Text_IO.Put_Line (Integer'Image (A'First) & Integer'Image (A'Last));
   end Show_Vec;
   procedure Show_Wec (A : Wec) is
   begin
      Ada.Text_IO.Put_Line (Integer'Image (A'First) & Integer'Image (A'Last));
   end Show_Wec;
   procedure Show_Three (A : Three) is
   begin
      Ada.Text_IO.Put_Line (Integer'Image (A'First) & Integer'Image (A'Last) & " " & A);
   end Show_Three;
begin
   Ada.Text_IO.Put_Line (Integer'Image (Small'First) & Integer'Image (Small'Last) & Integer'Image (Small'Width));
   Ada.Text_IO.Put_Line (Integer'Image (Upper'Width) & Integer'Image (Warm'Width) & " " & Color'Image (Warm'Last));
   X := X + 3;
   Ada.Text_IO.Put_Line (Integer'Image (X));
   for I in Small loop
      pragma Loop_Invariant (Count = I - Small'First);
      Count := Count + 1;
   end loop;
   Ada.Text_IO.Put_Line (Integer'Image (Count));
   Show_Vec ((1, 2));
   Show_Wec ((1, 2, 3));
   Show_Three ("ABC");
end Main;
