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] |
RM 6.3.1 (8) specifies that the operations inherited by a generic formal tagged derived type with unknown discriminants have convention Intrinsic. As a consequence, attribute 'Access cannot be applied to suvh an operation. This rule also makes it impossible to override an inherited operation of a type derived from such a formal type (a not uncommon usage), so in fact it probably needs to be relaxed. The straightforward solution adopted here is to say that the primitives of a type derived from such a formal type take their convention from the primitive operation of the ultimate non-generic ancestor. Compiling no_access.adb in ada 2005 mode must be rejected with the message: no_access.adb:22:12: prefix of "Access" attribute cannot be intrinsic --- procedure No_Access is package P is type Root is tagged null record; procedure Proc (X : Root); end P; package body P is procedure Proc (X : Root) is begin null; end; end P; generic type Formal (<>) is new P.Root with private; Value : Formal; package G is procedure Rien; end G; package body G is procedure Rien is begin -- attribute reference is illegal because inherited Proc is intrinsic if Proc'access = null then null; end if; end; Thing : Formal := Value; begin Proc (Thing); end G; begin null; end; --- Tested on x86_64-pc-linux-gnu, committed on trunk 2013-01-02 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb (Derive_Subprogram): Enforce RM 6.3.1 (8): if the derived type is a tagged generic formal type with unknown discriminants, the inherited operation has convention Intrinsic. As such, the 'Access attribute cannot be applied to it.
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] |