[multiple changes]

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.

From-SVN: r241040
This commit is contained in:
Arnaud Charlet 2016-10-12 14:57:23 +02:00
parent 84a62ce88b
commit 0026dd0a63
4 changed files with 33 additions and 3 deletions

View File

@ -1,3 +1,16 @@
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

View File

@ -4279,8 +4279,13 @@ package body Exp_Ch4 is
-- 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;

View File

@ -6377,6 +6377,13 @@ package body Sem_Ch10 is
-- 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.

View File

@ -9495,7 +9495,12 @@ package body Sem_Res is
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;