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]

[Ada] Type_Invariant'Class on interface types


This new language feature allows Type_Invariant'class on interface
types. When a type implements one or several interfaces, its inherited
type invariant is the conjunction of all ancestor Type_Invariant'Class.
The following package now compiles without errors:

package AI12_0041 is
   type VIntf is interface
      with Type_Invariant'Class => Is_Foo (VIntf);
   function Is_Foo (Obj : VIntf) return Boolean is abstract;

   type Test is private;
private
   type Test is new VIntf with null record;
   function Is_Foo (Obj : Test) return Boolean;
end;

Tested on x86_64-pc-linux-gnu, committed on trunk

2015-03-02  Javier Miranda  <miranda@adacore.com>

	* exp_ch9.adb (Build_Corresponding_Record): Propagate type
	invariants to the corresponding record type.
	* exp_disp.ad[sb] (Set_DT_Position_Value): New subprogram
	which sets the value of the DTC_Entity associated with a given
	primitive of a tagged type and propagates the value to the
	wrapped subprogram.
	(Set_DTC_Entity_Value): Propagate the DTC
	value to the wrapped entity.
	* sem_ch13.adb (Build_Invariant_Procedure): Append the code
	associated with invariants of progenitors.
	* sem_ch3.adb (Build_Derived_Record_Type): Inherit type invariants
	of parents and progenitors.
	(Process_Full_View): Check hidden inheritance of class-wide type
	invariants.
	* sem_ch7.adb (Analyze_Package_Specification): Do not generate
	the invariant procedure for interface types; build the invariant
	procedure for tagged types inheriting invariants from their
	progenitors.
	* sem_prag.adb (Pragma_Invariant) Allow invariants in interface
	types but do not build their invariant procedure since their
	invariants will be propagated to the invariant procedure of
	types covering the interface.
	* exp_ch6.adb, exp_disp.adb, sem_ch3.adb, sem_ch7.adb,
	sem_ch8.adb, sem_disp.adb: Replace all calls to Set_DT_Position
	by calls to Set_DT_Position_Value.

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]