This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Renamed child units in with-clauses.


If the parent unit in a with_clause is a unit renaming, the Load routine
replaces it with the unit it renames, in order to find the proper file that
holds the child unit. The original name is preserved in the with_clause, so
that the proper implicit with_clause can be generated when the context is
installed. The compiler did not handle properly the case when the unit renaming
is itself a child unit. In that case the compiler failed to create the proper
imkplicit with_clause, leading to spurious visibility errors.

The following must compile quietly:

with A1.B.C;
procedure P is
   X : integer := 15;
begin
   A1.B.C (X);
end;
--
package A1 is
   pragma Pure;
end A1;
---
with A1.X;
package A1.B renames A1.X;
---
package A1.X is
   type T is null record;
end A1.X;
---
Procedure A1.X.C (X : integer);

Tested on i686-pc-linux-gnu, committed on trunk

2008-07-31  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch10.adb (Build_Unit_Name): If the unit name in a with_clause
	has the form A.B.C and B is a unit renaming, analyze its compilation
	unit and add a with_clause on A.b to the context.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]