+2018-12-11 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch3.adb (Build_Itype_Reference): Handle properly an itype
+ reference created for a function that is a compilation unit, for
+ example if the function builds in place an object of a limited
+ type.
+
2018-12-11 Dmitriy Anisimkov <anisimko@adacore.com>
* libgnat/g-socket.ads, libgnat/g-socket.adb: Fix duration
-- If Nod is a library unit entity, then Insert_After won't work,
-- because Nod is not a member of any list. Therefore, we use
-- Add_Global_Declaration in this case. This can happen if we have a
- -- build-in-place library function.
+ -- build-in-place library function, child unit or not.
if (Nkind (Nod) in N_Entity and then Is_Compilation_Unit (Nod))
or else
- (Nkind (Nod) = N_Defining_Program_Unit_Name
- and then Is_Compilation_Unit (Defining_Identifier (Nod)))
+ (Nkind_In (Nod,
+ N_Defining_Program_Unit_Name, N_Subprogram_Declaration)
+ and then Is_Compilation_Unit (Defining_Entity (Nod)))
then
Add_Global_Declaration (IR);
else
+2018-12-11 Ed Schonberg <schonberg@adacore.com>
+
+ * gnat.dg/bip_cu.adb, gnat.dg/bip_cu_constructor.adb,
+ gnat.dg/bip_cu_constructor.ads, gnat.dg/bip_cu_t.adb,
+ gnat.dg/bip_cu_t.ads: New testcase.
+
2018-12-11 Hristian Kirtchev <kirtchev@adacore.com>
* gnat.dg/ghost2.adb, gnat.dg/ghost2.ads: New testcase.
--- /dev/null
+-- { dg-do compile }
+
+with BIP_CU_T; use BIP_CU_T;
+with BIP_CU_Constructor;
+
+procedure BIP_CU is
+ Value : constant T := BIP_CU_Constructor;
+begin
+ null;
+end;
--- /dev/null
+with BIP_CU_T; use BIP_CU_T;
+function BIP_CU_Constructor return T is
+begin
+ return Make_T (Name => "Rumplestiltskin");
+end BIP_CU_Constructor;
--- /dev/null
+with BIP_CU_T; use BIP_CU_T;
+function BIP_CU_Constructor return T;
--- /dev/null
+package body BIP_CU_T is
+
+ function Make_T (Name : String) return T is
+ begin
+ return (Name => To_Unbounded_String (Name), others => <>);
+ end Make_T;
+
+end BIP_CU_T;
--- /dev/null
+with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
+
+package BIP_CU_T is
+ type T is limited private;
+ function Make_T (Name : String) return T;
+private
+ type T is limited record
+ Name : Unbounded_String;
+ end record;
+end BIP_CU_T;