diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2024-09-11 19:42:03 +0200 |
---|---|---|
committer | Marc Poulhiès <dkm@gcc.gnu.org> | 2024-10-08 10:37:15 +0200 |
commit | d77ba2eec2a560514de162bf9499194250f291e2 (patch) | |
tree | e78264a91e0067b5da6a822d7d2d6f4da0940e9e /gcc | |
parent | cfbee1856f5125bbabc28088f62a86f3dee5a159 (diff) | |
download | gcc-d77ba2eec2a560514de162bf9499194250f291e2.zip gcc-d77ba2eec2a560514de162bf9499194250f291e2.tar.gz gcc-d77ba2eec2a560514de162bf9499194250f291e2.tar.bz2 |
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/sem_ch12.adb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index b406cfc..33f6f18 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; |