summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/discr21.adb
blob: 5c105cdb25c17fa2abb3fbf60d6d7e7fde2bfc90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
-- { dg-do compile }
-- { dg-options "-gnatws -O3" }

with Discr21_Pkg; use Discr21_Pkg;

package body Discr21 is

  type Index is new Natural range 0 .. 100;

  type Arr is array (Index range <> ) of Position;

  type Rec(Size : Index := 1) is record
    A : Arr(1 .. Size);
  end record;

  Data : Rec;

  function To_V(pos : Position) return VPosition is
  begin
    return To_Position(pos.x, pos.y, pos.z);
  end;

  procedure Read(Data : Rec) is
    pos : VPosition := To_V (Data.A(1));
  begin
    null;
  end;

  procedure Test is
  begin
    Read (Data);
  end;

end Discr21;