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] |
This patch ensures that assertion policy Ignore interacts properly with aspect Type_Invariant'Class. ------------ -- Source -- ------------ -- pack_type_invariant_class.ads pragma Assertion_Policy (Type_Invariant'Class => Ignore); package Pack_Type_Invariant_Class is type Priv_Typ is tagged private with Type_Invariant'Class => Is_Valid (Priv_Typ); function Is_Valid (Val : Priv_Typ) return Boolean; private type Priv_Typ is tagged record Comp : Natural := 10; end record; end Pack_Type_Invariant_Class; -- pack_type_invariant_class.adb package body Pack_Type_Invariant_Class is function Is_Valid (Val : Priv_Typ) return Boolean is begin return Val.Comp = 0; end Is_Valid; end Pack_Type_Invariant_Class; -- test_type_invariant_class.adb with Ada.Text_IO; use Ada.Text_IO; with Pack_Type_Invariant_Class; use Pack_Type_Invariant_Class; procedure Test_Type_Invariant_Class is begin declare Val : Priv_Typ; begin Put_Line ("OK"); end; exception when others => Put_Line ("ERROR: policy Type_Invariant'Class is Ignore"); end Test_Type_Invariant_Class; ---------------------------- -- Compilation and output -- ---------------------------- $ gnatmake -q -gnata test_type_invariant_class.adb $ ./test_type_invariant_class OK Tested on x86_64-pc-linux-gnu, committed on trunk 2015-05-26 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch6.adb (Process_Contract_Cases_For): Update the call to Expand_Pragma_Contract_Cases. * exp_prag.ads, exp_prag.adb (Expand_Contract_Cases): Rename to Expand_Pragma_Contract_Cases. * sem_ch13.adb (Add_Invariants): Use the original aspect name when creating the arguments of pragma Check. This ensures that 'Class is properly recognized and handled.
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] |