summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/lhs_view_convert.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gnat.dg/lhs_view_convert.adb')
-rw-r--r--gcc/testsuite/gnat.dg/lhs_view_convert.adb29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc/testsuite/gnat.dg/lhs_view_convert.adb b/gcc/testsuite/gnat.dg/lhs_view_convert.adb
new file mode 100644
index 000000000..e7947f033
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/lhs_view_convert.adb
@@ -0,0 +1,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;