diff options
author | Javier Miranda <miranda@adacore.com> | 2020-06-16 13:49:04 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-07-27 04:05:17 -0400 |
commit | 84ae33e7f55bc1c183ab907370dc6b967bd9b13a (patch) | |
tree | 6e97f50d5bd56c1f6ced9ae8eaee8c450d81299d /gcc | |
parent | 36f0cf4e6035406f64158946fff3bef9e2b4059c (diff) | |
download | gcc-84ae33e7f55bc1c183ab907370dc6b967bd9b13a.zip gcc-84ae33e7f55bc1c183ab907370dc6b967bd9b13a.tar.gz gcc-84ae33e7f55bc1c183ab907370dc6b967bd9b13a.tar.bz2 |
[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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/exp_ch6.adb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index 3886493..a7cfb65 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -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; --------------------------------------------------------- |