[COMMITTED] ada: Put back conversion to interface in more cases

Message ID 20230116144848.3171399-1-poulhies@adacore.com
State Unresolved
Headers
Series [COMMITTED] ada: Put back conversion to interface in more cases |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Marc Poulhiès Jan. 16, 2023, 2:48 p.m. UTC
  From: Eric Botcazou <ebotcazou@adacore.com>

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.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/exp_ch3.adb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
index c866a9c40f5..84594ed106b 100644
--- a/gcc/ada/exp_ch3.adb
+++ b/gcc/ada/exp_ch3.adb
@@ -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);