Debian Codegraph @

gcc/testsuite/gnat.dg/discr44.adb

raw
1 -- { dg-do run }
2 -- { dg-options "-gnatws" }
3
4 procedure Discr44 is
5
6 function Ident (I : Integer) return Integer is
7 begin
8 return I;
9 end;
10
11 type Int is range 1 .. 10;
12
13 type Str is array (Int range <>) of Character;
14
15 type Parent (D1, D2 : Int; B : Boolean) is record
16 S : Str (D1 .. D2);
17 end record;
18
19 type Derived (D : Int) is new Parent (D1 => D, D2 => D, B => False);
20
21 X1 : Derived (D => Int (Ident (7)));
22
23 begin
24 if X1.D /= 7 then
25 raise Program_Error;
26 end if;
27 end;