diff options
Diffstat (limited to 'gcc/ada/sem_ch4.adb')
-rw-r--r-- | gcc/ada/sem_ch4.adb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index 7824925..83705b9 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -2057,8 +2057,9 @@ package body Sem_Ch4 is -- For the predefined case, the result is Boolean, regardless of the -- type of the operands. The operands may even be limited, if they are -- generic actuals. If they are overloaded, label the operands with the - -- common type that must be present, or with the type of the formal of - -- the user-defined function. + -- compare type if it is present, typically because it is a global type + -- in a generic instance, or with the common type that must be present, + -- or with the type of the formal of the user-defined function. if Present (Entity (N)) then Op_Id := Entity (N); @@ -2071,7 +2072,10 @@ package body Sem_Ch4 is if Is_Overloaded (L) then if Ekind (Op_Id) = E_Operator then - Set_Etype (L, Intersect_Types (L, R)); + Set_Etype (L, + (if Present (Compare_Type (N)) + then Compare_Type (N) + else Intersect_Types (L, R))); else Set_Etype (L, Etype (First_Formal (Op_Id))); end if; @@ -2079,7 +2083,10 @@ package body Sem_Ch4 is if Is_Overloaded (R) then if Ekind (Op_Id) = E_Operator then - Set_Etype (R, Intersect_Types (L, R)); + Set_Etype (R, + (if Present (Compare_Type (N)) + then Compare_Type (N) + else Intersect_Types (L, R))); else Set_Etype (R, Etype (Next_Formal (First_Formal (Op_Id)))); end if; |