+2016-10-12 Justin Squirek <squirek@adacore.com>
+
+ * sem_ch10.adb (Remove_Limited_With_Clause): Add a check to
+ detect accidental visibility.
+
+2016-10-12 Ed Schonberg <schonberg@adacore.com>
+
+ * exp_ch4.adb (Expand_Allocator): If the expression is a qualified
+ expression, add a predicate check after the constraint check.
+ * sem_res.adb (Resolve_Qualified_Expression): If context is an
+ allocator, do not apply predicate check, as it will be done when
+ allocator is expanded.
+
2016-10-12 Bob Duff <duff@adacore.com>
* xref_lib.adb: Use renamings-of-slices to ensure
-- in the aggregate might not match the subtype mark in the allocator.
if Nkind (Expression (N)) = N_Qualified_Expression then
- Apply_Constraint_Check
- (Expression (Expression (N)), Etype (Expression (N)));
+ declare
+ Exp : constant Node_Id := Expression (Expression (N));
+ Typ : constant Entity_Id := Etype (Expression (N));
+ begin
+ Apply_Constraint_Check (Exp, Typ);
+ Apply_Predicate_Check (Exp, Typ);
+ end;
Expand_Allocator_Expression (N);
return;
-- Limited_Withed_Unit.
else
+ -- If the limited_with_clause is in some other unit in the context
+ -- then it is not visible in the main unit.
+
+ if not In_Extended_Main_Source_Unit (N) then
+ Set_Is_Immediately_Visible (P, False);
+ end if;
+
-- Real entities that are type or subtype declarations were hidden
-- from visibility at the point of installation of the limited-view.
-- Now we recover the previous value of the hidden attribute.
then
null;
- elsif Nkind (N) = N_Qualified_Expression then
+ -- In the case of a qualified expression in an allocator, the check
+ -- is applied when expanding the allocator, so avoid redundant check.
+
+ elsif Nkind (N) = N_Qualified_Expression
+ and then Nkind (Parent (N)) /= N_Allocator
+ then
Apply_Predicate_Check (N, Target_Typ);
end if;
end if;