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] |
The implicit child unit that is present in the instantiation of a parent generic is not materialized in the parent instance, but retrieved when instantiated. This requires installing the parent instance on the scope stack. This patch handles the case where the generic unit being instantiated is a renaming of the implicit child within a parent unit, where additional tree traversal is needed to retrieve the parent instance. The following must compile and execute quietly: with p; with decl; procedure main is package x is new decl.r; begin if X.Var /= 1111 then raise Program_Error; end if; end main; --- generic X : integer; package gp1 is Val : Integer := X; type some_type is new integer; end gp1; --- generic package gp1.gp2 is type and_now_something_completely_different is new some_type; Var : integer := Val; end; --- with gp1; package p is new gp1 (1111); --- with gp1.gp2; with p; package decl is generic package r renames p.gp2; end decl; Tested on x86_64-pc-linux-gnu, committed on trunk 2010-10-19 Ed Schonberg <schonberg@adacore.com> * sem_ch12.adb (Check_Generic_Child_Unit): Handle properly the case of an instantiation of a renaming of the implicit generic child that appears within an instance of 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] |