+2019-09-17 Yannick Moy <moy@adacore.com>
+
+ * sem_spark.adb (Check_Declaration): Do not check the assignment
+ from an illegal declaration.
+
2019-09-17 Bob Duff <duff@adacore.com>
* doc/gnat_ugn/gnat_and_program_execution.rst: Clarify
Target : constant Entity_Id := Defining_Identifier (Decl);
Target_Typ : constant Node_Id := Etype (Target);
Expr : Node_Id;
- Dummy : Boolean := True;
+ Legal : Boolean := True;
begin
-- Start with legality rules not related to permissions
- Check_Declaration_Legality (Decl, Force => True, Legal => Dummy);
+ Check_Declaration_Legality (Decl, Force => True, Legal => Legal);
-- Now check permission-related legality rules
when N_Full_Type_Declaration =>
null;
- -- ??? What about component declarations with defaults.
+ -- ??? What about component declarations with defaults.
when N_Subtype_Declaration =>
Check_Expression (Subtype_Indication (Decl), Read);
when N_Object_Declaration =>
Expr := Expression (Decl);
- if Present (Expr) then
+ if Legal and then Present (Expr) then
Check_Assignment (Target => Target,
Expr => Expr);
end if;
+ -- Always add variable to the current permission environment,
+ -- even in the illegal case, as the rest of the analysis expects
+ -- to find it.
+
if Is_Deep (Target_Typ) then
declare
Tree : constant Perm_Tree_Access :=