https://gcc.gnu.org/g:177050b65968336bd9b1c6e94e343274f3582d78

commit r15-9892-g177050b65968336bd9b1c6e94e343274f3582d78
Author: Gary Dismukes <dismu...@adacore.com>
Date:   Fri May 16 23:11:26 2025 +0000

    ada: Compiler fails on unchecked deallocation for constrained protected 
subtype
    
    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.

Diff:
---
 gcc/ada/sem_ch3.adb | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 8246e6c9643f..794e4204d842 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -14601,6 +14601,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));

Reply via email to