Commit 5b4c1029 by Ed Schonberg Committed by Arnaud Charlet

sem_ch12.adb (Check_Formal_Package_Instance): Skip an internal formal entity…

sem_ch12.adb (Check_Formal_Package_Instance): Skip an internal formal entity without a parent only if...

2016-10-12  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch12.adb (Check_Formal_Package_Instance): Skip an internal
	formal entity without a parent only if the corresponding actual
	entity has a different kind.
	* exp_ch9.adb (Build_Class_Wide_Master): If the master is
	declared locally, insert the renaming declaration after the
	master declaration, to prevent access before elaboration in gigi.

From-SVN: r241029
parent 05662a06
2016-10-12 Ed Schonberg <schonberg@adacore.com>
* sem_ch12.adb (Check_Formal_Package_Instance): Skip an internal
formal entity without a parent only if the corresponding actual
entity has a different kind.
* exp_ch9.adb (Build_Class_Wide_Master): If the master is
declared locally, insert the renaming declaration after the
master declaration, to prevent access before elaboration in gigi.
2016-10-12 Ed Schonberg <schonberg@adacore.com>
* contracts.adb (Analyze_Contracts): For a type declaration, analyze
an iterable aspect when present.
......
......@@ -1107,6 +1107,7 @@ package body Exp_Ch9 is
procedure Build_Class_Wide_Master (Typ : Entity_Id) is
Loc : constant Source_Ptr := Sloc (Typ);
Master_Id : Entity_Id;
Master_Decl : Node_Id;
Master_Scope : Entity_Id;
Name_Id : Node_Id;
Related_Node : Node_Id;
......@@ -1146,13 +1147,12 @@ package body Exp_Ch9 is
-- the second transient scope requires a _master, it cannot use the one
-- already declared because the entity is not visible.
Name_Id := Make_Identifier (Loc, Name_uMaster);
Name_Id := Make_Identifier (Loc, Name_uMaster);
Master_Decl := Empty;
if not Has_Master_Entity (Master_Scope)
or else No (Current_Entity_In_Scope (Name_Id))
then
declare
Master_Decl : Node_Id;
begin
Set_Has_Master_Entity (Master_Scope);
......@@ -1214,7 +1214,17 @@ package body Exp_Ch9 is
Subtype_Mark => New_Occurrence_Of (Standard_Integer, Loc),
Name => Name_Id);
Insert_Action (Related_Node, Ren_Decl);
-- If the master is declared locally, add the renaming declaration
-- immediately after it, to prevent access-before-elaboration in the
-- back-end.
if Present (Master_Decl) then
Insert_After (Master_Decl, Ren_Decl);
Analyze (Ren_Decl);
else
Insert_Action (Related_Node, Ren_Decl);
end if;
Set_Master_Id (Typ, Master_Id);
end Build_Class_Wide_Master;
......
......@@ -5989,7 +5989,7 @@ package body Sem_Ch12 is
-- itypes and predefined operators (concatenation for arrays, eg).
-- Skip it and keep the formal entity to find a later match for it.
elsif No (Parent (E2)) then
elsif No (Parent (E2)) and then Ekind (E1) /= Ekind (E2) then
E1 := Prev_E1;
goto Next_E;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment