+2014-01-24 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch3.adb (Analyze_Declarations): At the end of an
+ appropriate declarative part, call Freeze_All from the first
+ declaration in the scope, not from the first unfrozen one. This
+ is necessary to apply visibility checks to entities with delayed
+ aspects. Otherwise, in the presence of instantiations and cleanups
+ that they may generate, the delayed aspects may be analyzed too
+ late and produce spurious visibility errors.
+ * sem_attr.adb: Place etype on range.
+ * sem_ch6.adb: Documentation expression functions.
+
2014-01-24 Robert Dewar <dewar@adacore.com>
* exp_ch7.adb: Minor change of Indices to Indexes (preferred
(Low_Bound (Index), Etype (Index_Type));
Analyze_And_Resolve
(High_Bound (Index), Etype (Index_Type));
+ Set_Etype (Index, Etype (Index_Type));
else
Analyze_And_Resolve (Index, Etype (Index_Type));
Freeze_From := First_Entity (Current_Scope);
end if;
+ -- There may have been several freezing points previously,
+ -- for example object declarations or subprogram bodies, but
+ -- at the end of a declarative part we check freezing from
+ -- the beginning, even though entities may already be frozen,
+ -- in order to perform visibility checks on delayed aspects.
+
Adjust_Decl;
- Freeze_All (Freeze_From, Decl);
+ Freeze_All (First_Entity (Current_Scope), Decl);
Freeze_From := Last_Entity (Current_Scope);
elsif Scope (Current_Scope) /= Standard_Standard
or else Is_Empty_List (Private_Declarations (Parent (L)))
then
Adjust_Decl;
- Freeze_All (Freeze_From, Decl);
+ Freeze_All (First_Entity (Current_Scope), Decl);
Freeze_From := Last_Entity (Current_Scope);
end if;
-- To prevent premature freeze action, insert the new body at the end
-- of the current declarations, or at the end of the package spec.
-- However, resolve usage names now, to prevent spurious visibility
- -- on later entities.
+ -- on later entities. Note that the function can now be called in
+ -- the current declarative part, which will appear to be prior to
+ -- the presence of the body in the code. There are nevertheless no
+ -- order of elaboration issues because all name resolution has taken
+ -- place at the point of declaration.
declare
Decls : List_Id := List_Containing (N);