https://gcc.gnu.org/g:9403c84cc26f62d1c83ab8999bacd81d511347f4

commit r16-1857-g9403c84cc26f62d1c83ab8999bacd81d511347f4
Author: Javier Miranda <mira...@adacore.com>
Date:   Tue May 6 17:41:51 2025 +0000

    ada: Dispatching call with mutably tagged objects
    
    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.

Diff:
---
 gcc/ada/sem_ch4.adb | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index 89beb2b9a7e0..f5b051910353 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -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

Reply via email to