[Ada] Fix incorrect call to inherited function with limited return type
authorEric Botcazou <ebotcazou@adacore.com>
Sat, 5 Mar 2022 18:18:18 +0000 (19:18 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Fri, 13 May 2022 08:04:47 +0000 (08:04 +0000)
This is a return convention mismatch coming from a discrepancy of the
Returns_By_Ref flag for the inherited function.

gcc/ada/

* sem_ch3.adb (Derive_Subprogram): For a function, also copy the
Returns_By_Ref flag from the parent.

gcc/ada/sem_ch3.adb

index b81216c..054648b 100644 (file)
@@ -16333,6 +16333,7 @@ package body Sem_Ch3 is
 
       if Ekind (New_Subp) = E_Function then
          Set_Mechanism (New_Subp, Mechanism (Parent_Subp));
+         Set_Returns_By_Ref (New_Subp, Returns_By_Ref (Parent_Subp));
       end if;
 
       --  Ada 2022 (AI12-0279): If a Yield aspect is specified True for a