aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch12.adb
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2008-05-26 11:41:37 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2008-05-26 11:41:37 +0200
commit6b9aa5780f4fd86cf0d5e5a30a0692d600a83096 (patch)
treee1105a860766e46b1fc47cdb6b32d19946aaa62e /gcc/ada/sem_ch12.adb
parentc99990440ced6708203b252ba48b528e9512b671 (diff)
downloadgcc-6b9aa5780f4fd86cf0d5e5a30a0692d600a83096.zip
gcc-6b9aa5780f4fd86cf0d5e5a30a0692d600a83096.tar.gz
gcc-6b9aa5780f4fd86cf0d5e5a30a0692d600a83096.tar.bz2
2008-05-26 Ed Schonberg <schonberg@adacore.com>
* sem_ch12.adb: (Remove_Parent): If the enclosing scope is an instance whose generic parent is declared within some parent scope of the just completed instance, make full views of the entities in that parent visible, when applicable. From-SVN: r135908
Diffstat (limited to 'gcc/ada/sem_ch12.adb')
-rw-r--r--gcc/ada/sem_ch12.adb19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index 75f4512..9a79d42 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -10807,6 +10807,10 @@ package body Sem_Ch12 is
procedure Remove_Parent (In_Body : Boolean := False) is
S : Entity_Id := Current_Scope;
+ -- S is the scope containing the instantiation just completed. The
+ -- scope stack contains the parent instances of the instantiation,
+ -- followed by the original S.
+
E : Entity_Id;
P : Entity_Id;
Hidden : Elmt_Id;
@@ -10853,6 +10857,21 @@ package body Sem_Ch12 is
and then not Parent_Unit_Visible)
then
Set_Is_Immediately_Visible (P, False);
+
+ -- If the current scope is itself an instantiation of a generic
+ -- nested within P, and we are in the private part of body of
+ -- this instantiation, restore the full views of P, that were
+ -- removed in End_Package_Scope above. This obscure case can
+ -- occur when a subunit of a generic contains an instance of
+ -- of a child unit of its generic parent unit.
+
+ elsif S = Current_Scope
+ and then Is_Generic_Instance (S)
+ and then P = Scope (Generic_Parent (Parent (S)))
+ and then (In_Package_Body (S) or else In_Private_Part (S))
+ then
+ Set_In_Private_Part (P);
+ Install_Private_Declarations (P);
end if;
end loop;