This avoids a useless walk of the prefix chain in instances.
gcc/ada/
* sem_ch8.adb (Analyze_Subprogram_Renaming): Move final test on
In_Instance to outer condition.
-- normally illegal renamings can be constructed when expanding
-- instantiations.
- elsif Nkind (Nam) = N_Expanded_Name then
+ elsif Nkind (Nam) = N_Expanded_Name and then not In_Instance then
declare
function Ult_Expanded_Prefix (N : Node_Id) return Node_Id is
(if Nkind (N) /= N_Expanded_Name
begin
if Chars (Entity (Ult_Expanded_Prefix (Nam))) = Chars (New_S)
- and then not In_Instance
then
Error_Msg_Sloc := Sloc (N);
Error_Msg_NE