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] |
In Ada 2012, static matching of subtypes requires that the static predicates that apply to the subtypes come from the same declaration. Compiling predmatch.ads in Ada 2012 mode must yield: predmatch.ads:5:21: object subtype must statically match designated subtype predmatch.ads:12:22: object subtype must statically match designated subtype predmatch.ads:15:22: object subtype must statically match designated subtype --- package Predmatch is type Int_Ref is access all Integer; subtype Even is Integer with Dynamic_predicate => Even mod 2 = 0; X1 : aliased Even; Ptr : Int_Ref := X1'access; -- Illegal in Ada 2012 subtype Little_Even is Integer with Static_Predicate => Little_Even in 2 | 4 | 8 | 16; X2 : aliased Little_Even; Ptr2 : Int_Ref := X2'Access; -- illegal in Ada 2012 type Pos_Ref is access all Positive; Ptr3 : Pos_Ref := X1'access; -- Illegal in Ada 2005 subtype Mult2 is Even; type Mult_Ref is access all Mult2; Ptr4 : Mult_Ref := X1'Access; -- OK, same predicate end Predmatch; Tested on x86_64-pc-linux-gnu, committed on trunk 2012-05-15 Ed Schonberg <schonberg@adacore.com> * sem_eval.adb (Subtypes_Statically_Match): In Ada 2012, static matching requires matching of static subtype predicates as well.
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] |