ada: Put back conversion to interface in more cases
authorEric Botcazou <ebotcazou@adacore.com>
Tue, 3 Jan 2023 07:20:30 +0000 (08:20 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 16 Jan 2023 14:44:54 +0000 (15:44 +0100)
This needs to be done for all expressions with class-wide type.

gcc/ada/

* exp_ch3.adb (Make_Allocator_For_Return): Put back an interface
conversion for expressions with non-interface class-wide type.

gcc/ada/exp_ch3.adb

index c866a9c..84594ed 100644 (file)
@@ -7185,7 +7185,7 @@ package body Exp_Ch3 is
             --  remove earlier in the processing.
 
             if Is_Interface (Typ)
-              and then Is_Interface (Etype (Alloc_Expr))
+              and then Is_Class_Wide_Type (Etype (Alloc_Expr))
               and then Typ /= Etype (Alloc_Expr)
             then
                Alloc_Expr := Convert_To (Typ, Alloc_Expr);