diff options
author | Bob Duff <duff@adacore.com> | 2025-07-16 10:29:01 -0400 |
---|---|---|
committer | Marc Poulhiès <dkm@gcc.gnu.org> | 2025-07-25 10:09:36 +0200 |
commit | 91fc017022c66e475da5ea5528f983d840800e40 (patch) | |
tree | 4b0ab8eb6bab9d2f1c0db0506e663ba6996a3964 /gcc | |
parent | 54cc682bcc7ee16e0476e33bab0d3af0f41f63c2 (diff) | |
download | gcc-91fc017022c66e475da5ea5528f983d840800e40.zip gcc-91fc017022c66e475da5ea5528f983d840800e40.tar.gz gcc-91fc017022c66e475da5ea5528f983d840800e40.tar.bz2 |
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/sem_ch12.adb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 1cb9d11..b5c9e88 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -7574,6 +7574,12 @@ package body Sem_Ch12 is or else not Same_Instantiated_Function (E1, E2)); end if; + -- No check is needed if this is the body of a subprogram that is + -- implicitly created in the case of class-wide predefined functions. + + elsif Ekind (E1) = E_Subprogram_Body then + null; + else raise Program_Error; end if; |