From: Eric Botcazou Date: Tue, 7 Dec 2021 21:10:53 +0000 (+0100) Subject: [Ada] Fix spurious error on instantiation with Text_IO name X-Git-Tag: upstream/12.2.0~2394 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ffbc891aaa97892303bded2b1c07b2bf6034a679;p=platform%2Fupstream%2Fgcc.git [Ada] Fix spurious error on instantiation with Text_IO name gcc/ada/ * sem_ch8.adb (Analyze_Package_Renaming): Do not check for Text_IO special units when the name of the renaming is a generic instance, which is the case for package instantiations in the GNAT model. --- diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index 8ee3496..a70077a 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -1594,9 +1594,18 @@ package body Sem_Ch8 is return; end if; - -- Check for Text_IO special unit (we may be renaming a Text_IO child) + -- Check for Text_IO special units (we may be renaming a Text_IO child), + -- but make sure not to catch renamings generated for package instances + -- that have nothing to do with them but are nevertheless homonyms. - Check_Text_IO_Special_Unit (Name (N)); + if Is_Entity_Name (Name (N)) + and then Present (Entity (Name (N))) + and then Is_Generic_Instance (Entity (Name (N))) + then + null; + else + Check_Text_IO_Special_Unit (Name (N)); + end if; if Current_Scope /= Standard_Standard then Set_Is_Pure (New_P, Is_Pure (Current_Scope));