[Ada] Spurious error in taft ammendment derivation of CPP type
authorJavier Miranda <miranda@adacore.com>
Sat, 25 Jul 2020 17:16:32 +0000 (13:16 -0400)
committerPierre-Marie de Rodat <derodat@adacore.com>
Wed, 21 Oct 2020 07:22:43 +0000 (03:22 -0400)
gcc/ada/

* sem_ch3.adb (Build_Derived_Type): Propagate convention of
class-wide parent.

gcc/ada/sem_ch3.adb

index be5ed6714507270ab5fc046e12dd9e495d8a9b34..a8baad99d6bba77f710d67ed77bb6211b9d692be 100644 (file)
@@ -9751,6 +9751,13 @@ package body Sem_Ch3 is
 
       Set_Convention (Derived_Type, Convention (Parent_Base));
 
+      if Is_Tagged_Type (Derived_Type)
+        and then Present (Class_Wide_Type (Derived_Type))
+      then
+         Set_Convention (Class_Wide_Type (Derived_Type),
+           Convention (Class_Wide_Type (Parent_Base)));
+      end if;
+
       --  Set SSO default for record or array type
 
       if (Is_Array_Type (Derived_Type) or else Is_Record_Type (Derived_Type))