]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Compiler fails on unchecked deallocation for constrained protected subtype
authorGary Dismukes <dismukes@adacore.com>
Fri, 16 May 2025 23:11:26 +0000 (23:11 +0000)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Tue, 1 Jul 2025 08:29:43 +0000 (10:29 +0200)
The compiler fails with an error or Assert_Failure when calling
an instantiation of Unchecked_Deallocation that has been instantiated
with a constrained subtype of a discriminated protected type.

gcc/ada/ChangeLog:

* sem_ch3.adb (Constrain_Corresponding_Record): Inherit Class_Wide_Type on the
created constrained subtype.

gcc/ada/sem_ch3.adb

index 2673874a6bf5cd54a0390999372754037173137f..45b28bf96a4b65f750e4914a381db826c9976b73 100644 (file)
@@ -14882,6 +14882,7 @@ package body Sem_Ch3 is
       Set_Etype             (T_Sub, Corr_Rec);
       Set_Has_Discriminants (T_Sub, Has_Discriminants (Prot_Subt));
       Set_Is_Tagged_Type    (T_Sub, Is_Tagged_Type (Corr_Rec));
+      Set_Class_Wide_Type   (T_Sub, Class_Wide_Type (Corr_Rec));
       Set_Is_Constrained    (T_Sub, True);
       Set_First_Entity      (T_Sub, First_Entity (Corr_Rec));
       Set_Last_Entity       (T_Sub, Last_Entity  (Corr_Rec));