summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/lhs_view_convert.adb
blob: e7947f033d889730e4a53b6053d2b2f60fef6641 (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
-- { dg-do run }
-- { dg-options "-gnatp" }

procedure Lhs_View_Convert is

   type Root is tagged record
      RV : Natural;
   end record;

   type Derived is new Root with null record;

   Root_Instance : Root := (RV => 1);

   Derived_Instance : Derived;

   procedure Process is
      X : Natural := Derived_Instance.RV;
   begin
      null;
   end;
begin
   Derived_Instance.RV := 2;
   
   Root (Derived_Instance) := Root (Root_Instance);
   
   if Derived_Instance.RV /= Root_Instance.RV then
      raise Program_Error;
   end if;
end;