Skip to content

Commit 2fb7db8

Browse files
bobduffEric Botcazou
authored andcommitted
ada: Bug in Indefinite_Holders instance passed to formal package
Fix bug when an instance of Indefinite_Holders with a class-wide type is passed as a generic formal package; Program_Error was raised when dealing with the implicit "=" function. The fix is to disable legality checks in formal packages when the entity is an E_Subprogram_Body, because these are implicitly generated for class-wide predefined functions when passed to generics. gcc/ada/ChangeLog: * sem_ch12.adb (Check_Formal_Package_Instance): Do nothing in case of E_Subprogram_Body.
1 parent 9662803 commit 2fb7db8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

gcc/ada/sem_ch12.adb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7542,6 +7542,12 @@ package body Sem_Ch12 is
75427542
or else not Same_Instantiated_Function (E1, E2));
75437543
end if;
75447544

7545+
-- No check is needed if this is the body of a subprogram that is
7546+
-- implicitly created in the case of class-wide predefined functions.
7547+
7548+
elsif Ekind (E1) = E_Subprogram_Body then
7549+
null;
7550+
75457551
else
75467552
raise Program_Error;
75477553
end if;

0 commit comments

Comments
 (0)