]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Dispatching call with mutably tagged objects
authorJavier Miranda <miranda@adacore.com>
Tue, 6 May 2025 17:41:51 +0000 (17:41 +0000)
committerEric Botcazou <ebotcazou@adacore.com>
Tue, 1 Jul 2025 14:33:58 +0000 (16:33 +0200)
The compiler rejects performing a dispatching call using the
prefix notation when the prefix of the call is a mutably
tagged class-wide type object.

gcc/ada/ChangeLog:

* sem_ch4.adb (Try_Object_Operation): Handle mutably tagged
class-wide type prefix.

gcc/ada/sem_ch4.adb

index 8be9647e5c02cf45039031b03b22bc88332a4515..4b403e6285810a0567bbf3563b23f1dff43822aa 100644 (file)
@@ -10907,6 +10907,10 @@ package body Sem_Ch4 is
    --  Start of processing for Try_Object_Operation
 
    begin
+      if Is_Class_Wide_Equivalent_Type (Obj_Type) then
+         Obj_Type := Corresponding_Mutably_Tagged_Type (Obj_Type);
+      end if;
+
       Analyze_Expression (Obj);
 
       --  Analyze the actuals if node is known to be a subprogram call