Debian Codegraph @

gcc/testsuite/gnat.dg/discr33.adb

raw
1 -- { dg-do run }
2
3 procedure Discr33 is
4
5 subtype Int is Integer range 1..100;
6
7 type T (D : Int := 1) is
8 record
9 A : Integer;
10 B : String (1..D);
11 C : aliased Integer;
12 end record;
13
14 Var : T := (D => 1, A => 1234, B => "x", C => 4567);
15
16 type Int_Ref is access all Integer;
17 Pointer_To_C : Int_Ref := Var.C'Access;
18
19 begin
20
21 if Pointer_To_C.all /= 4567 then
22 raise Program_Error;
23 end if;
24
25 Var := (D => 26, A => 1234, B => "abcdefghijklmnopqrstuvwxyz", C => 2345);
26
27 if Pointer_To_C.all /= 2345 then
28 raise Program_Error;
29 end if;
30
31 end Discr33;