Skip to content

Commit 20ad15c

Browse files
author
Eric Botcazou
committed
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.
1 parent 4f06ce1 commit 20ad15c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gcc/ada/sem_ch12.adb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6735,7 +6735,7 @@ package body Sem_Ch12 is
67356735
-- Remove package itself from visibility, so it does not
67366736
-- conflict with subprogram.
67376737

6738-
Set_Name_Entity_Id (Chars (Pack_Id), Homonym (Pack_Id));
6738+
Remove_Homonym (Pack_Id);
67396739

67406740
-- Set name and scope of internal subprogram so that the proper
67416741
-- external name will be generated. The proper scope is the scope

0 commit comments

Comments
 (0)