When detecting calls to subprograms specified for aspects of a type, the
entity denoted by the aspects must go through Ultimate_Alias, since that
of the name of the calls did the same.
gcc/ada/ChangeLog:
* exp_ch6.adb (Expand_Call_Helper): Call Ultimate_Alias for the
detection of calls to subprograms specified for Constant_Indexing.
* exp_util.adb (Is_Indexed_Container): Likewise.
(Is_Iterated_Container): Likewise for Default_Iterator.
elsif Nkind (Call_Node) = N_Function_Call
and then Nkind (Parent (Call_Node)) = N_Function_Call
+ and then Is_Entity_Name (Name (Parent (Call_Node)))
then
declare
Aspect : constant Node_Id :=
Find_Value_Of_Aspect
(Etype (Call_Node), Aspect_Constant_Indexing);
+ Subp : constant Entity_Id := Entity (Name (Parent (Call_Node)));
begin
if Present (Aspect)
- and then Is_Entity_Name (Name (Parent (Call_Node)))
- and then Entity (Name (Parent (Call_Node))) = Entity (Aspect)
+ and then Subp = Ultimate_Alias (Entity (Aspect))
then
-- Resolution is now finished, make sure we don't start
-- analysis again because of the duplication.
Aspect := Find_Value_Of_Aspect (Typ, Aspect_Constant_Indexing);
if Present (Aspect) then
- Index := Entity (Aspect);
+ Index := Ultimate_Alias (Entity (Aspect));
-- Examine the statements following the container object and
-- look for a call to the default indexing routine where the
Aspect := Find_Value_Of_Aspect (Typ, Aspect_Default_Iterator);
if Present (Aspect) then
- Iter := Entity (Aspect);
+ Iter := Ultimate_Alias (Entity (Aspect));
-- Examine the statements following the container object and
-- look for a call to the default iterate routine where the