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] Resolving self-references to a child generic unit in an instance


This patch fixes a name resolution problem in a child instance. involving a
name of the form A.B.C, where A. B and C constitute a generic hierarchy.
Within an instance of C, this name must be rewritten to denote the instances
of A, B and C. Previously the compiler only handled one level of child units.

The following must compile quietly:

      gnatmake -q pack-td.ads

---
with Gen_Pack.Child.TD;
with Gen_Pack.Child.TD.T;
package Pack.TD is
   package TD_Inst is new Pack.Smth2.TD;
   package T_Inst is new TD_Inst.T;
end Pack.TD;
--
with Gen_Pack;
with Gen_Pack.Child;

package Pack is
   package Smth  is new Gen_Pack (Integer);
   package Smth2 is new Smth.Child;
end Pack;
--
generic
   type Formal_Type is range <>;
package Gen_Pack is
   function Self (X : Formal_Type) return Formal_Type is (X);
end Gen_Pack;
--
generic
package Gen_Pack.Child is
   function Minus_Self (X : Formal_Type) return Formal_Type is (-X);
end Gen_Pack.Child;
--
generic
package Gen_Pack.Child.TD is
   type Tst is tagged null record;
end Gen_Pack.Child.TD;
--
generic
package Gen_Pack.Child.TD.T is
   type Tst is new Gen_Pack.Child.TD.Tst with null record;
end Gen_Pack.Child.TD.T;

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

2013-10-10  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch8.adb (Find_Expanded_Name): Handle properly a fully
	qualified reference to a generic child unit within itself,
	in an instantiation.

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]