aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJavier Miranda <miranda@adacore.com>2020-06-16 13:49:04 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2020-07-27 04:05:17 -0400
commit84ae33e7f55bc1c183ab907370dc6b967bd9b13a (patch)
tree6e97f50d5bd56c1f6ced9ae8eaee8c450d81299d /gcc
parent36f0cf4e6035406f64158946fff3bef9e2b4059c (diff)
downloadgcc-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.adb10
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;
---------------------------------------------------------