From: squirek <squi...@adacore.com>

This patch fixes an issue in the compiler whereby declarations of derived types
whose parent is a mutably tagged type cause early freezing of the parent type -
leading to spurious compile-time errors.

gcc/ada/ChangeLog:
        * sem_ch3.adb (Derived_Type_Declaration): Modify generation of
        compile time check.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/sem_ch3.adb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index e2050e4a9bf..2a48882d83c 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -17956,8 +17956,8 @@ package body Sem_Ch3 is
                   --  to the backend since we don't know the true size of
                   --  anything at this point.
 
-                  Insert_After_And_Analyze (N,
-                    Make_CW_Size_Compile_Check (T, Root_Class_Typ));
+                  Append_Freeze_Actions (T,
+                    New_List (Make_CW_Size_Compile_Check (T, Root_Class_Typ)));
                end if;
             end if;
          end;
-- 
2.43.0

Reply via email to