Commit 3bb9bd7d by Ed Schonberg Committed by Pierre-Marie de Rodat

[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
parent 61770974
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> 2018-07-31 Hristian Kirtchev <kirtchev@adacore.com>
* checks.adb, contracts.adb, exp_aggr.adb, exp_ch5.adb, * checks.adb, contracts.adb, exp_aggr.adb, exp_ch5.adb,
......
...@@ -8977,12 +8977,16 @@ package body Sem_Ch4 is ...@@ -8977,12 +8977,16 @@ package body Sem_Ch4 is
-- to same. If in an instance, the operation can be considered -- to same. If in an instance, the operation can be considered
-- even if hidden (it may be hidden because the instantiation -- even if hidden (it may be hidden because the instantiation
-- is expanded after the containing package has been analyzed). -- 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); Hom := Current_Entity (Subprog);
while Present (Hom) loop while Present (Hom) loop
if Ekind_In (Hom, E_Procedure, E_Function) if Ekind_In (Hom, E_Procedure, E_Function)
and then Present (Renamed_Entity (Hom)) and then Present (Renamed_Entity (Hom))
and then Is_Generic_Actual_Subprogram (Hom) and then Is_Generic_Actual_Subprogram (Hom)
and then In_Open_Scopes (Scope (Hom))
then then
Candidate := Renamed_Entity (Hom); Candidate := Renamed_Entity (Hom);
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment