From: Eric Botcazou Date: Wed, 11 Sep 2024 17:42:03 +0000 (+0200) Subject: ada: Fix bogus error in instantiation with formal package X-Git-Tag: basepoints/gcc-16~5391 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d77ba2eec2a560514de162bf9499194250f291e2;p=thirdparty%2Fgcc.git 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 --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index b406cfce3b3..33f6f18c50b 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -7337,8 +7337,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;