https://gcc.gnu.org/g:20ad15cfebe0eb571b02956f0628a78c3161184c
commit r16-4699-g20ad15cfebe0eb571b02956f0628a78c3161184c Author: Eric Botcazou <[email protected]> Date: Tue Oct 28 23:04:49 2025 +0100 Ada: Fix visibility issue for child unit declared as instance on homonym The reproducer is made up of 9 units containing multiple level of nested instances, but in the end the problem is that the final child unit has the same name as the parameter in its instantiation, exposing the wrong manipulation of the homonym chain done in Analyze_Subprogram_Instantiation. The fix is to replace this manipulation with a call to Remove_Homonym. gcc/ada/ PR ada/48039 * sem_ch12.adb (Analyze_Subprogram_Instantiation): Call Remove_Homonym to remove the enclosing package from visibility. Diff: --- gcc/ada/sem_ch12.adb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index b5c276a04bd9..cbb0debbf1fb 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -6735,7 +6735,7 @@ package body Sem_Ch12 is -- Remove package itself from visibility, so it does not -- conflict with subprogram. - Set_Name_Entity_Id (Chars (Pack_Id), Homonym (Pack_Id)); + Remove_Homonym (Pack_Id); -- Set name and scope of internal subprogram so that the proper -- external name will be generated. The proper scope is the scope
