From f622acc1eb2679f14758a1ad6c5b693cd9bdea23 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sun, 5 Jan 2025 23:21:31 +0100 Subject: ada: Accept predefined multiply operator for fixed point in expression function The RM 4.5.5(19.1/2) subclause says that the predefined multiply operator for universal_fixed is still available, despite the declaration of a user- defined primitive multiply operator for the fixed-point type at stake, if it is identified using an expanded name with prefix denoting Standard, but this is currently not the case in the context of an expression function. gcc/ada/ChangeLog: PR ada/118274 * sem_ch4.adb (Check_Arithmetic_Pair.Has_Fixed_Op): Use the original node of the operator to identify the case of an expanded name whose prefix is the package Standard. --- gcc/ada/sem_ch4.adb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'gcc/ada') diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index 5b9456b..4069839 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -6619,18 +6619,20 @@ package body Sem_Ch4 is ------------------ function Has_Fixed_Op (Typ : Entity_Id; Op : Entity_Id) return Boolean is - Bas : constant Entity_Id := Base_Type (Typ); + Bas : constant Entity_Id := Base_Type (Typ); + Orig_N : constant Node_Id := Original_Node (N); + Ent : Entity_Id; F1 : Entity_Id; F2 : Entity_Id; begin - -- If the universal_fixed operation is given explicitly the rule + -- If the universal_fixed operation is given explicitly, the rule -- concerning primitive operations of the type do not apply. - if Nkind (N) = N_Function_Call - and then Nkind (Name (N)) = N_Expanded_Name - and then Entity (Prefix (Name (N))) = Standard_Standard + if Nkind (Orig_N) = N_Function_Call + and then Nkind (Name (Orig_N)) = N_Expanded_Name + and then Entity (Prefix (Name (Orig_N))) = Standard_Standard then return False; end if; -- cgit v1.1