aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEd Schonberg <schonber@gnat.com>2001-12-11 23:27:40 +0000
committerGeert Bosch <bosch@gcc.gnu.org>2001-12-12 00:27:40 +0100
commit0b09835f1f9a32e9a4d30d47692d2f4809db6bb3 (patch)
tree20471bbeacf06ec0d9b47d29e54e88c99e53cff3 /gcc
parent598c344654d8f0119bd38977cb22898c48ec83bb (diff)
downloadgcc-0b09835f1f9a32e9a4d30d47692d2f4809db6bb3.zip
gcc-0b09835f1f9a32e9a4d30d47692d2f4809db6bb3.tar.gz
gcc-0b09835f1f9a32e9a4d30d47692d2f4809db6bb3.tar.bz2
sem_ch10.adb (Install_Withed_Unit): If the unit is a generic instance that is the parent of other generics...
* sem_ch10.adb (Install_Withed_Unit): If the unit is a generic instance that is the parent of other generics, the instance body replaces the instance node. Retrieve the instance of the spec, which is the one that is visible in clients and within the body. From-SVN: r47906
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog7
-rw-r--r--gcc/ada/sem_ch10.adb15
2 files changed, 20 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index a1f2589..2f055e3 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,10 @@
+2001-12-11 Ed Schonberg <schonber@gnat.com>
+
+ * sem_ch10.adb (Install_Withed_Unit): If the unit is a generic instance
+ that is the parent of other generics, the instance body replaces the
+ instance node. Retrieve the instance of the spec, which is the one
+ that is visible in clients and within the body.
+
2001-12-11 Vincent Celier <celier@gnat.com>
* gnatmain.adb: Initial version.
diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb
index 2bbe0a5..8a1cc69 100644
--- a/gcc/ada/sem_ch10.adb
+++ b/gcc/ada/sem_ch10.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- $Revision: 1.402 $
+-- $Revision$
-- --
-- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
-- --
@@ -2708,10 +2708,21 @@ package body Sem_Ch10 is
-------------------------
procedure Install_Withed_Unit (With_Clause : Node_Id) is
- Uname : constant Entity_Id := Entity (Name (With_Clause));
+ Uname : Entity_Id := Entity (Name (With_Clause));
P : constant Entity_Id := Scope (Uname);
begin
+ -- If the unit is a package instantiation, its body may have been
+ -- generated for an inner instance, and the instance now denotes the
+ -- body entity. For visibility purposes we need the instance in the
+ -- specification.
+
+ if Ekind (Uname) = E_Package_Body
+ and then Is_Generic_Instance (Uname)
+ then
+ Uname := Spec_Entity (Uname);
+ end if;
+
-- We do not apply the restrictions to an internal unit unless
-- we are compiling the internal unit as a main unit. This check
-- is also skipped for dummy units (for missing packages).