From 3bb9bd7dcc46a48b45419072e552336d3e6569fd Mon Sep 17 00:00:00 2001 From: Ed Schonberg Date: Tue, 31 Jul 2018 09:55:21 +0000 Subject: [PATCH] [Ada] Fix resolution of class-wide operations that are generic actuals 2018-07-31 Ed Schonberg gcc/ada/ * sem_ch4.adb (Traverse_Homonyms): Consider generic actuals that may rename a matching class-wide operation only if the renaming declaration for that actual is in an enclosing scope (i.e. within the corrresponding instance). From-SVN: r263090 --- gcc/ada/ChangeLog | 7 +++++++ gcc/ada/sem_ch4.adb | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 00432f6b110..ef1128ff2a7 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2018-07-31 Ed Schonberg + + * sem_ch4.adb (Traverse_Homonyms): Consider generic actuals that + may rename a matching class-wide operation only if the renaming + declaration for that actual is in an enclosing scope (i.e. + within the corrresponding instance). + 2018-07-31 Hristian Kirtchev * checks.adb, contracts.adb, exp_aggr.adb, exp_ch5.adb, diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index 89af5676348..5176175d434 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -8977,12 +8977,16 @@ package body Sem_Ch4 is -- to same. If in an instance, the operation can be considered -- even if hidden (it may be hidden because the instantiation -- is expanded after the containing package has been analyzed). + -- If the subprogram is a generic actual in an enclosing instance, + -- it appears as a renaming that is a candidate interpretation as + -- well. Hom := Current_Entity (Subprog); while Present (Hom) loop if Ekind_In (Hom, E_Procedure, E_Function) and then Present (Renamed_Entity (Hom)) and then Is_Generic_Actual_Subprogram (Hom) + and then In_Open_Scopes (Scope (Hom)) then Candidate := Renamed_Entity (Hom); else -- 2.30.2