This patch does not affect the behavior of Ada-only code but improves
consistency with the code generated by the C++ compiler.

Tested on x86_64-pc-linux-gnu, committed on trunk

2018-09-26  Javier Miranda  <mira...@adacore.com>

gcc/ada/

        * sem_res.adb (Resolve_Actuals): If the formal is a class-wide
        type conversion then do not skip resolving and expanding the
        conversion; required to displace the pointer to the object and
        reference the dispatch table associated with the target
        interface type.
--- gcc/ada/sem_res.adb
+++ gcc/ada/sem_res.adb
@@ -3809,6 +3809,7 @@ package body Sem_Res is
             if Ekind (F) /= E_In_Parameter
               and then Nkind (A) = N_Type_Conversion
               and then not Is_Class_Wide_Type (Etype (Expression (A)))
+              and then not Is_Interface (Etype (A))
             then
                if Ekind (F) = E_In_Out_Parameter
                  and then Is_Array_Type (Etype (F))

Reply via email to