end loop;
end if;
- if Ekind (Etype (Nam)) = E_Access_Subprogram_Type
- and then Ekind (Typ) /= E_Access_Subprogram_Type
+ if Is_Access_Subprogram_Type (Base_Type (Etype (Nam)))
+ and then not Is_Access_Subprogram_Type (Base_Type (Typ))
and then Nkind (Subp) /= N_Explicit_Dereference
and then Present (Parameter_Associations (N))
then
-- The prefix is a parameterless function call that returns an
-- access to subprogram. If parameters are present in the current
- -- call add an explicit dereference.
+ -- call add an explicit dereference. We use the base type here
+ -- because within an instance these may be subtypes.
-- The dereference is added either in Analyze_Call or here. Should
-- be consolidated ???