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] Visibility of a generic grand-child unit instantiated in its parent.


This patch fixes a spurious error when a generic grand-child unit is
instantiated in the body of its parent, i.e. a generic child unit, and the
name of the grand-child is fully qualified with that of its ancestors.

The following must compile quietly:

   gnatmake -q c

---
with A;
procedure C is
   package Ai is new A (1);
begin
   Ai.Op;
end C;
---
generic
   I : Integer;
package A is

   procedure Op;

end A;
---
generic
   I : Integer;
package B is

   procedure Op;

end B;
---
with B;
package body A is

   package Ins is new B (I);

   procedure Op is
   begin
      Ins.op;
   end Op;

end A;
---
package body B.A.C is

   Z : Integer;
   --------
   -- Op --
   --------

   procedure Op is
   begin
      Z := Z + 1;
   end Op;

end B.A.C;
---
generic
   I : Integer;
package B.A.C is

   procedure Op;

end B.A.C;
---
with B.A.C;
package body B.A is

   package Inst is new B.A.C (I);

   --------
   -- op --
   --------

   procedure op is
   begin
      Inst.Op;
   end op;

end B.A;
---
generic
   I : Integer;
package B.A is

   procedure op;

end B.A;
---
with B.A;
package body B is

   package Insx is new A (I);

   procedure Op is
   begin
      Insx.Op;
   end op;

end B;

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

2015-05-12  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch8.adb (Find_Expanded_Name): Handle properly a fully
	qualified name for an instance of a generic grand-child unit in
	the body its parent.

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]