===================================================================
@@ -6029,12 +6029,43 @@ package body Sem_Ch8 is
Change_Selected_Component_To_Expanded_Name (N);
end if;
- Add_One_Interp (N, Predef_Op, T);
+ -- If the context is an unanalyzed function call, determine whether
+ -- a binary or unary interpretation is required.
- -- For operators with unary and binary interpretations, add both
+ if Nkind (Parent (N)) = N_Indexed_Component then
+ declare
+ Is_Binary_Call : constant Boolean
+ := Present (Next (First (Expressions (Parent (N)))));
+ Is_Binary_Op : constant Boolean
+ := First_Entity (Predef_Op) /= Last_Entity (Predef_Op);
+ Predef_Op2 : constant Entity_Id := Homonym (Predef_Op);
+
+ begin
+ if Is_Binary_Call then
+ if Is_Binary_Op then
+ Add_One_Interp (N, Predef_Op, T);
+ else
+ Add_One_Interp (N, Predef_Op2, T);
+ end if;
- if Present (Homonym (Predef_Op)) then
- Add_One_Interp (N, Homonym (Predef_Op), T);
+ else
+ if not Is_Binary_Op then
+ Add_One_Interp (N, Predef_Op, T);
+ else
+ Add_One_Interp (N, Predef_Op2, T);
+ end if;
+ end if;
+ end;
+
+ else
+ Add_One_Interp (N, Predef_Op, T);
+
+ -- For operators with unary and binary interpretations, if
+ -- context is not a call, add both
+
+ if Present (Homonym (Predef_Op)) then
+ Add_One_Interp (N, Homonym (Predef_Op), T);
+ end if;
end if;
-- The node is a reference to a predefined operator, and