summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/empty_vector_length.adb
blob: 256a254e2e25f58f04483e7587ec0638ce20fff5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
--  { dg-do run }
--  { dg-options "-gnatp" }

procedure Empty_Vector_Length is

   type Vector is array (Integer range <>) of Integer;

   function Empty_Vector return Vector is
   begin
      return (2 .. Integer'First => 0);
   end;

   My_Vector : Vector := Empty_Vector;
   My_Length : Integer := My_Vector'Length;
begin
   if My_Length /= 0 then
      raise Program_Error;
   end if;
end;