https://gcc.gnu.org/g:8547dab3cb619b91112466bc0dc97379240b9011
commit r13-9091-g8547dab3cb619b91112466bc0dc97379240b9011 Author: Eric Botcazou <ebotca...@adacore.com> Date: Wed Sep 11 19:42:03 2024 +0200 ada: Fix bogus error in instantiation with formal package The compiler reports that an actual does not match the formal when there is a defaulted formal discrete type because Check_Formal_Package_Instance fails to skip the implicit base type generated by the compiler. gcc/ada/ChangeLog: PR ada/114636 * sem_ch12.adb (Check_Formal_Package_Instance): For a defaulted formal discrete type, skip the generated implicit base type. Diff: --- gcc/ada/sem_ch12.adb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index ff62ff003278..89581bd5bb60 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -6693,8 +6693,12 @@ package body Sem_Ch12 is then -- If the formal is a tagged type the corresponding class-wide -- type has been generated as well, and it must be skipped. + -- Likewise, for a formal discrete type, the base type has been + -- generated as well (see Analyze_Formal_Discrete_Type). - if Is_Type (E2) and then Is_Tagged_Type (E2) then + if Is_Type (E2) + and then (Is_Tagged_Type (E2) or else Is_Enumeration_Type (E2)) + then Next_Entity (E2); end if;