diff options
Diffstat (limited to 'gcc/ada/sem_ch8.adb')
| -rw-r--r-- | gcc/ada/sem_ch8.adb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index eeff994..790ca00 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -1918,6 +1918,11 @@ package body Sem_Ch8 is Rewrite (N, Body_Node); Analyze (N); + if Is_Compilation_Unit (New_S) then + Error_Msg_N + ("a library unit can only rename another library unit", N); + end if; + Set_Etype (New_S, Base_Type (Etype (New_S))); -- We suppress elaboration warnings for the resulting entity, since @@ -2051,6 +2056,14 @@ package body Sem_Ch8 is then Error_Msg_N ("renamed unit must be a library unit", Name (N)); + -- Entities defined in Standard (operators and boolean literals) cannot + -- be renamed as library units. + + elsif Scope (Old_E) = Standard_Standard + and then Sloc (Old_E) = Standard_Location + then + Error_Msg_N ("renamed unit must be a library unit", Name (N)); + elsif Present (Parent_Spec (N)) and then Nkind (Unit (Parent_Spec (N))) = N_Generic_Package_Declaration and then not Is_Child_Unit (Old_E) |
