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] |
Ada2012 introduce a new kind of formal type definition. An incomplete formal type can be instantiated with any actual (as long as discriminants and tagged nature conform). The actual for a formal incomplete type is not frozen by the instance itself. The following must compile quietly in Ada2012 mode: --- procedure test1 is generic type Later; package G is X : Integer; end G; package Inst is new G (Integer); generic type Latest is tagged; package G2 is It : Float; end; type TT is tagged null record; package Inst2 is new G2 (TT); package Inner is type T; package Inst3 is new G (T); type T is array (1..10) of integer; private end Inner; package Inner2 is type T is private; package Inst3 is new G (T); private type T is array (1..10) of integer; end Inner2; begin null; end; Tested on x86_64-pc-linux-gnu, committed on trunk 2011-08-29 Ed Schonberg <schonberg@adacore.com> * sinfo.ads, sinfo.adb: New node kind N_Formal_Incomplete_Type_Definition, related flags. par-ch12.adb (P_Formal_Type_Declaration, G_Formal_Type_Definition): Parse formal incomplete types. * sem.adb (Analyze): Formal_Incomplete_Type_Definitions are handled in sem_ch12. * sem_ch7.adb (Analyze_Package_Specification, Unit_Requires_Body): Formal incomplete types do not need completion. * sem_ch12.adb (Analyze_Formal_Incomplete_Type, Validate_Incomplete_Type_Instance): New procedures to handle formal incomplete types. * freeze.adb (Freeze_Entity): Do not freeze the subtype of an actual that corresponds to a formal incomplete type. * sprint.adb: Handle formal incomplete type declarations. * exp_util.adb (Insert_Actions): An incomplete_type_definition is not an insertion point.
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] |