https://gcc.gnu.org/g:bf268b3d5e82d8269081b5b8dac302e0e04b820f

commit r17-715-gbf268b3d5e82d8269081b5b8dac302e0e04b820f
Author: Denis Mazzucato <[email protected]>
Date:   Tue Dec 23 11:02:49 2025 +0100

    ada: Fix propagation of by-constructor indication from composition
    
    This patch stops the propagation of by-constructor indication from 
composition.
    Only derived tagged types should propagate this indication.
    
    gcc/ada/ChangeLog:
    
            * sem_ch3.adb (Build_Derived_Type): Propagate by-constructor 
indication
            only for derived tagged types, not for composition.

Diff:
---
 gcc/ada/sem_ch3.adb | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 6bf7e308f1c2..63ae1147a4fd 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -10454,6 +10454,12 @@ package body Sem_Ch3 is
       if Is_Tagged_Type (Derived_Type) then
          Set_No_Tagged_Streams_Pragma
            (Derived_Type, No_Tagged_Streams_Pragma (Parent_Type));
+
+         --  Propagate information about constructor dependence from parent
+
+         Set_Needs_Construction
+           (Derived_Type,
+            Needs_Construction (Parent_Type));
       end if;
 
       --  If the parent has primitive routines and may have not-seen-yet aspect
@@ -23474,14 +23480,6 @@ package body Sem_Ch3 is
 
          Propagate_Concurrent_Flags (T, Etype (Component));
 
-         --  Propagate information about constructor dependence
-
-         if Ekind (Etype (Component)) /= E_Void
-           and then Needs_Construction (Etype (Component))
-         then
-            Set_Needs_Construction (T);
-         end if;
-
          if Ekind (Component) /= E_Component then
             null;

Reply via email to