+2019-09-19 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch7.adb (Install_Parent_Private_Declarations): If a
+ generic child unit is instantiated within a sibling child unit,
+ the analysis of its private part requires that the private part
+ of the ancestor be available, as is done when the context
+ includes an instance of the ancestor.
+
2019-09-19 Yannick Moy <moy@adacore.com>
* inline.adb (Can_Be_Inlined_In_GNATprove_Mode): Add special
Inst_Par := Renamed_Entity (Inst_Par);
end if;
- Gen_Par :=
- Generic_Parent
- (Specification (Unit_Declaration_Node (Inst_Par)));
+ -- The instance may appear in a sibling generic unit, in
+ -- which case the prefix must include the common (generic)
+ -- ancestor, which is treated as a current instance.
+
+ if Inside_A_Generic
+ and then Ekind (Inst_Par) = E_Generic_Package
+ then
+ Gen_Par := Inst_Par;
+ pragma Assert (In_Open_Scopes (Gen_Par));
+
+ else
+ Gen_Par :=
+ Generic_Parent
+ (Specification (Unit_Declaration_Node (Inst_Par)));
+ end if;
-- Install the private declarations and private use clauses
-- of a parent instance of the child instance, unless the
+2019-09-19 Ed Schonberg <schonberg@adacore.com>
+
+ * gnat.dg/generic2-child.ads, gnat.dg/generic2-io_any.adb,
+ gnat.dg/generic2-io_any.ads, gnat.dg/generic2.ads: New testcase.
+
2019-09-19 Yannick Moy <moy@adacore.com>
* gnat.dg/global2.adb, gnat.dg/global2.ads: New testcase.
--- /dev/null
+generic
+package Generic2.Child is
+private
+ type My_Int is new Int;
+end Generic2.Child;
--- /dev/null
+-- { dg-do compile }
+
+package body Generic2.IO_Any is
+ procedure Dummy is null;
+end Generic2.IO_Any;
\ No newline at end of file
--- /dev/null
+with Generic2.Child;
+generic
+package Generic2.IO_Any is
+ package V1 is new Generic2.Child;
+ procedure Dummy;
+end Generic2.IO_Any;
--- /dev/null
+generic
+package Generic2 is
+private
+ type Int is new Integer;
+end Generic2;