]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix propagation of by-constructor indication from composition
authorDenis Mazzucato <mazzucato@adacore.com>
Tue, 23 Dec 2025 10:02:49 +0000 (11:02 +0100)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Mon, 25 May 2026 08:28:04 +0000 (10:28 +0200)
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.

gcc/ada/sem_ch3.adb

index 6bf7e308f1c2aec993629e309f795408de7e76c6..63ae1147a4fd67df6ee093eef62190458e8c7d43 100644 (file)
@@ -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;