+2018-08-21 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_res.adb (Resolve_Call): Resolve correctly a parameterless
+ call that returns an access type whose designated type is the
+ component type of an array, when the function has no defaulted
+ parameters.
+
2018-08-21 Yannick Moy <moy@adacore.com>
* doc/gnat_ugn/building_executable_programs_with_gnat.rst:
Ret_Type : constant Entity_Id := Etype (Nam);
begin
- if Is_Access_Type (Ret_Type)
+ -- If this is a parameterless call there is no ambiguity
+ -- and the call has the type of the function.
+
+ if No (First_Actual (N)) then
+ Set_Etype (N, Etype (Nam));
+ if Present (First_Formal (Nam)) then
+ Resolve_Actuals (N, Nam);
+ end if;
+ Build_Call_Marker (N);
+
+ elsif Is_Access_Type (Ret_Type)
+
and then Ret_Type = Component_Type (Designated_Type (Ret_Type))
then
Error_Msg_N
+2018-08-21 Ed Schonberg <schonberg@adacore.com>
+
+ * gnat.dg/access5.adb, gnat.dg/access5.ads: New testcase.
+
2018-08-21 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/rep_clause7.adb: New testcase.
--- /dev/null
+-- { dg-do compile }
+
+package body Access5 is
+ procedure Dummy is null;
+end;
--- /dev/null
+package Access5 is
+ type Vec;
+ type Ptr is access all Vec;
+ type Vec is array (1..3) of Ptr;
+ function F return Ptr;
+ pragma Import (Ada, F);
+ Tail : Vec := (F, F, F);
+
+ procedure Dummy;
+end;