From c886a946134d08a3ae3ad2dacbcee8d6b981db1d Mon Sep 17 00:00:00 2001 From: Javier Miranda Date: Wed, 26 Sep 2018 09:18:29 +0000 Subject: [PATCH] [Ada] Mimic the C++ ABI when passing class-wide conversion actuals This patch does not affect the behavior of Ada-only code but improves consistency with the code generated by the C++ compiler. 2018-09-26 Javier Miranda 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. From-SVN: r264624 --- gcc/ada/ChangeLog | 8 ++++++++ gcc/ada/sem_res.adb | 1 + 2 files changed, 9 insertions(+) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index b9187b6338e..5996edc98dc 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,11 @@ +2018-09-26 Javier Miranda + + * 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. + 2018-09-26 Hristian Kirtchev * libgnat/g-dynhta.adb (Prepend_Or_Replace): Update the number diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 5354d81630b..6a3dfb74c85 100644 --- a/gcc/ada/sem_res.adb +++ b/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)) -- 2.30.2