diff options
author | Ed Schonberg <schonberg@adacore.com> | 2018-07-31 09:55:21 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2018-07-31 09:55:21 +0000 |
commit | 3bb9bd7dcc46a48b45419072e552336d3e6569fd (patch) | |
tree | 30d1271beb36d52d579448ddd77c7152a3129b6e | |
parent | 617709748bf6e8c9590ce8a19a20c57de53a08e2 (diff) | |
download | gcc-3bb9bd7dcc46a48b45419072e552336d3e6569fd.zip gcc-3bb9bd7dcc46a48b45419072e552336d3e6569fd.tar.gz gcc-3bb9bd7dcc46a48b45419072e552336d3e6569fd.tar.bz2 |
[Ada] Fix resolution of class-wide operations that are generic actuals
2018-07-31 Ed Schonberg <schonberg@adacore.com>
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
-rw-r--r-- | gcc/ada/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/ada/sem_ch4.adb | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 00432f6..ef1128f 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2018-07-31 Ed Schonberg <schonberg@adacore.com> + + * 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 <kirtchev@adacore.com> * 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 89af567..5176175 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 |