summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/modify_a_constant.adb
blob: 576378b0bd25c420ea14a26448707ca51382b726 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
--  { dg-do compile }

with text_io; use text_io;
procedure modify_a_constant is
    type Outer;
    type Inner (Outer_Ref : access Outer) is limited null record;
        
    type Outer is limited record
        Inner_Field   : Inner (Outer_Ref => Outer'Access);
        Integer_Field : Integer;
      end record;
     
    X : constant Outer := (Inner_Field => <>, Integer_Field => 123);
     
begin
   Put_Line (Integer'image (X.Integer_Field));
   X.Inner_Field.Outer_Ref.Integer_Field := 0;
   Put_Line (Integer'image (X.Integer_Field));
end Modify_A_Constant;