aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2020-10-20 09:42:57 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2020-11-26 03:39:38 -0500
commit3268fb4dace884ad985965cbd64f3804b2f8fd74 (patch)
treef668d57c48f17b3556baa67268395c41a80bf722
parent1e00c00d8a74a5f7dc8583aeb146f21e13b252ab (diff)
downloadgcc-3268fb4dace884ad985965cbd64f3804b2f8fd74.zip
gcc-3268fb4dace884ad985965cbd64f3804b2f8fd74.tar.gz
gcc-3268fb4dace884ad985965cbd64f3804b2f8fd74.tar.bz2
[Ada] Spurious error on formal package with overloaded subprograms
gcc/ada/ * sem_ch12.adb (Instantiate_Formal_Package): If previous matched entity is overloadable, advance in the list of actuals of the actual package, to prevent an erroneous match of two adjacent overloadable homonyms with the same entity.
-rw-r--r--gcc/ada/sem_ch12.adb10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index dfb0765..20a00d7 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -10801,6 +10801,16 @@ package body Sem_Ch12 is
Next_Non_Pragma (Formal_Node);
Next (Actual_Of_Formal);
+ -- A formal subprogram may be overloaded, so advance in
+ -- the list of actuals to make sure we do not match two
+ -- successive formals to the same actual. This is only
+ -- relevant for overloadable entities, others have
+ -- distinct names.
+
+ if Is_Overloadable (Actual_Ent) then
+ Next_Entity (Actual_Ent);
+ end if;
+
else
-- No further formals to match, but the generic part may
-- contain inherited operation that are not hidden in the