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] fix a name resolution issue in generic


Tested on i686-linux, committed on mainline.

A package instance I of a generic G includes a renaming declaration with
name G, to allow local references of the form G.X to be resolved properly
in the instance. If the generic contains some local entity also called G,
there will be a spurious conflict in the instance between the local G
and the package renaming. In such a case name resolution must choose the
local entity, given that in the generic this local entity also hid the
original package name.
The following must compile quietly:

procedure Example is
   generic
      with procedure R1;
      with function R1 return integer;
   package R1 is
      procedure Proc;
   end R1;

   package body R1 is
      Val : integer;
      procedure Proc is
      begin
         R1;             --  must resolve to actual for procedure
         Val := R1;      --  must resolve to actual for function
      end;
   end R1;

   procedure F is  begin null; end;
   function G return integer is begin return 7; end;
   package P is new R1 (F, G);
begin
   null;
end;

2005-07-07  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch8.adb (Find_Direct_Name): Handle properly the case of a
	generic package that contains local declarations with the same name.
	(Analyze_Object_Renaming): Check wrong renaming of incomplete type.

Attachment: difs.8
Description: Text document


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