]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Clean up previous change
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 13 Nov 2024 15:37:32 +0000 (16:37 +0100)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Tue, 26 Nov 2024 09:49:36 +0000 (10:49 +0100)
gcc/ada/ChangeLog:

* sem_res.adb (Valid_Conversion): Do not initialize Opnd_Type before
calling Get_Corresponding_Mutably_Tagged_Type_If_Present.

gcc/ada/sem_res.adb

index 9cd1db1a9aa6f99526cab6ea0579631b155ff556..5ca2061352956ee18f9c2a0289b9b0bc6a3c9b4f 100644 (file)
@@ -13803,7 +13803,7 @@ package body Sem_Res is
       Report_Errs : Boolean := True) return Boolean
    is
       Target_Type  : constant Entity_Id := Base_Type (Target);
-      Opnd_Type    : Entity_Id          := Etype (Operand);
+      Opnd_Type    : Entity_Id;
       Inc_Ancestor : Entity_Id;
 
       function Conversion_Check
@@ -14270,14 +14270,10 @@ package body Sem_Res is
    begin
       Check_Parameterless_Call (Operand);
 
-      if Is_Overloaded (Operand) then
-         if Is_Ambiguous_Operand (Operand) then
-            return False;
-         end if;
-
-         --  The Etype may have been updated by Is_Ambiguous_Operand
-
-         Opnd_Type := Etype (Operand);
+      if Is_Overloaded (Operand)
+        and then Is_Ambiguous_Operand (Operand)
+      then
+         return False;
       end if;
 
       --  When we encounter a class-wide equivalent type used to represent
@@ -14285,7 +14281,7 @@ package body Sem_Res is
       --  at the class-wide mutably tagged type instead.
 
       Opnd_Type :=
-        Get_Corresponding_Mutably_Tagged_Type_If_Present (Opnd_Type);
+        Get_Corresponding_Mutably_Tagged_Type_If_Present (Etype (Operand));
 
       --  Deal with conversion of integer type to address if the pragma
       --  Allow_Integer_Address is in effect. We convert the conversion to