]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Accept predefined multiply operator for fixed point in expression function
authorEric Botcazou <ebotcazou@adacore.com>
Sun, 5 Jan 2025 22:21:31 +0000 (23:21 +0100)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Thu, 9 Jan 2025 12:56:38 +0000 (13:56 +0100)
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

index 5b9456bed0a58519d513cda398d3714e8c9b973d..406983995f3df26183ad5391dc4d7817d13854e7 100644 (file)
@@ -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;