+2019-07-04 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * sem_util.adb (Propagate_DIC_Attributes): Do not propagate the
+ Default_Initial_Condition attributes to an incomplete type.
+
2019-07-04 Ed Schonberg <schonberg@adacore.com>
* sem_attr.adb (Check_Array_Type): An array type attribute such
if From_Typ = Typ then
return;
+
+ -- Nothing to do when the destination denotes an incomplete type
+ -- because the DIC is associated with the current instance of a
+ -- private type, thus it can never apply to an incomplete type.
+
+ elsif Is_Incomplete_Type (Typ) then
+ return;
end if;
DIC_Proc := DIC_Procedure (From_Typ);
+2019-07-04 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * gnat.dg/default_initial_condition.adb,
+ gnat.dg/default_initial_condition_pack.adb,
+ gnat.dg/default_initial_condition_pack.ads: New testcase.
+
2019-07-04 Ed Schonberg <schonberg@adacore.com>
* gnat.dg/aspect2.adb, gnat.dg/aspect2.ads: New testcase.
--- /dev/null
+-- { dg-do run }
+-- { dg-options "-gnata" }
+
+with Default_Initial_Condition_Pack; use Default_Initial_Condition_Pack;
+
+procedure Default_Initial_Condition is
+ Obj : T;
+begin
+ if not DIC_Called then
+ raise Program_Error;
+ end if;
+end Default_Initial_Condition;
--- /dev/null
+package body Default_Initial_Condition_Pack is
+ function Is_OK (Val : T) return Boolean is
+ begin
+ DIC_Called := True;
+ return True;
+ end Is_OK;
+end Default_Initial_Condition_Pack;
--- /dev/null
+package Default_Initial_Condition_Pack is
+ type T;
+ type T is private
+ with Default_Initial_Condition => Is_OK (T);
+
+ function Is_OK (Val : T) return Boolean;
+
+ DIC_Called : Boolean := False;
+
+private
+ type T is null record;
+end Default_Initial_Condition_Pack;