The declaration of an abstract function with an operator designator can
result in removing a nonhomographic user-defined operator as a possible
interpretation in an overloaded expression, leading to an error about
mismatched types. The condition for marking an interpretation as being
a predefined operator that should be hidden by an abstract operator
function was incomplete, and only checked that the result was numeric,
without checking that the interpretation was actually for an operator.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* sem_ch4.adb (Remove_Abstract_Operations): Add condition to
test for an E_Operator as part of criteria for setting
Abstract_Op on interpretations involving predefined operators.
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -8029,6 +8029,7 @@ package body Sem_Ch4 is
while Present (It.Nam) loop
if Is_Numeric_Type (It.Typ)
and then Scope (It.Typ) = Standard_Standard
+ and then Ekind (It.Nam) = E_Operator
then
Set_Abstract_Op (I, Abstract_Op);
end if;