[Ada] Interface behaves differently from abstract tagged null
authorJavier Miranda <miranda@adacore.com>
Fri, 2 Jul 2021 17:13:12 +0000 (13:13 -0400)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 21 Sep 2021 15:24:57 +0000 (15:24 +0000)
gcc/ada/

* exp_ch6.adb (Expand_Simple_Function_Return): For explicit
dereference of type conversion, enable code that ensures that
the tag of the result is that of the result type.

gcc/ada/exp_ch6.adb

index 5055184..7717fa7 100644 (file)
@@ -7437,6 +7437,10 @@ package body Exp_Ch6 is
         and then not Is_Class_Wide_Type (Utyp)
         and then (Nkind (Exp) in
                       N_Type_Conversion | N_Unchecked_Type_Conversion
+                    or else (Nkind (Exp) = N_Explicit_Dereference
+                               and then Nkind (Prefix (Exp)) in
+                                          N_Type_Conversion |
+                                          N_Unchecked_Type_Conversion)
                     or else (Is_Entity_Name (Exp)
                                and then Is_Formal (Entity (Exp))))
       then