[Ada] Spurious error in generic dispatching constructor

gcc/ada/

	* exp_ch6.adb (Make_Build_In_Place_Iface_Call_In_Allocator):
	Revert previous patch, and add a missing type conversion to
	displace the pointer to the allocated object to reference the
	target dispatch table.
This commit is contained in:
Javier Miranda 2020-06-16 13:49:04 -04:00 committed by Pierre-Marie de Rodat
parent 36f0cf4e60
commit 84ae33e7f5
1 changed files with 7 additions and 3 deletions

View File

@ -9726,8 +9726,7 @@ package body Exp_Ch6 is
-- declaration.
Anon_Type := Create_Itype (E_Anonymous_Access_Type, Function_Call);
Set_Directly_Designated_Type (Anon_Type,
Designated_Type (Etype (Allocator)));
Set_Directly_Designated_Type (Anon_Type, Etype (BIP_Func_Call));
Set_Etype (Anon_Type, Anon_Type);
Build_Class_Wide_Master (Anon_Type);
@ -9757,7 +9756,12 @@ package body Exp_Ch6 is
(Allocator => Expression (Tmp_Decl),
Function_Call => Expression (Expression (Tmp_Decl)));
Rewrite (Allocator, New_Occurrence_Of (Tmp_Id, Loc));
-- Add a conversion to displace the pointer to the allocated object
-- to reference the corresponding dispatch table.
Rewrite (Allocator,
Convert_To (Etype (Allocator),
New_Occurrence_Of (Tmp_Id, Loc)));
end Make_Build_In_Place_Iface_Call_In_Allocator;
---------------------------------------------------------