[Ada] Spurious error in generic dispatching constructor call
authorJavier Miranda <miranda@adacore.com>
Tue, 26 May 2020 18:54:15 +0000 (14:54 -0400)
committerPierre-Marie de Rodat <derodat@adacore.com>
Fri, 10 Jul 2020 09:16:19 +0000 (05:16 -0400)
gcc/ada/

* exp_ch6.adb (Make_Build_In_Place_Iface_Call_In_Allocator):
Build the internal anonymous access type using as a reference
the designated type imposed by the context (instead of using the
return type of the called function).

gcc/ada/exp_ch6.adb

index 776ff49daeae6e364858768a4505067250beb76c..329f3b53a9cd74c9da97e413093278475a6d3472 100644 (file)
@@ -9709,7 +9709,8 @@ package body Exp_Ch6 is
       --  declaration.
 
       Anon_Type := Create_Itype (E_Anonymous_Access_Type, Function_Call);
-      Set_Directly_Designated_Type (Anon_Type, Etype (BIP_Func_Call));
+      Set_Directly_Designated_Type (Anon_Type,
+        Designated_Type (Etype (Allocator)));
       Set_Etype (Anon_Type, Anon_Type);
       Build_Class_Wide_Master (Anon_Type);