+2019-07-04 Yannick Moy <moy@adacore.com>
+
+ * sem_util.adb (Yields_Synchronized_Object): Adapt to new SPARK
+ rule.
+
2019-07-04 Yannick Moy <moy@adacore.com>
* sem_spark.adb (Check_Statement): Only check permission of
-- synchronized object.
if Etype (Typ) /= Typ
+ and then not Is_Private_Type (Etype (Typ))
and then not Yields_Synchronized_Object (Etype (Typ))
then
return False;
elsif Is_Synchronized_Interface (Typ) then
return True;
- -- A task type yelds a synchronized object by default
+ -- A task type yields a synchronized object by default
elsif Is_Task_Type (Typ) then
return True;
+ -- A private type yields a synchronized object if its underlying type
+ -- does.
+
+ elsif Is_Private_Type (Typ)
+ and then Present (Underlying_Type (Typ))
+ then
+ return Yields_Synchronized_Object (Underlying_Type (Typ));
+
-- Otherwise the type does not yield a synchronized object
else
+2019-07-04 Yannick Moy <moy@adacore.com>
+
+ * gnat.dg/synchronized2.adb, gnat.dg/synchronized2.ads,
+ gnat.dg/synchronized2_pkg.ads: New testcase.
+
2019-07-04 Justin Squirek <squirek@adacore.com>
* gnat.dg/generic_inst4.adb, gnat.dg/generic_inst4_gen.ads,
--- /dev/null
+with Synchronized2_Pkg;
+package body Synchronized2 with SPARK_Mode, Refined_State => (State => C) is
+ C : Synchronized2_Pkg.T;
+ procedure Dummy is null;
+end;
--- /dev/null
+-- { dg-do compile }
+package Synchronized2 with SPARK_Mode, Abstract_State => (State with Synchronous) is
+ procedure Dummy;
+end;
--- /dev/null
+package Synchronized2_Pkg with SPARK_Mode is
+ type T is limited private;
+private
+ task type T;
+end;