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] AI05-0197: Dispatching with multiple inherited operations


This AI resolves a conflict between an inherited null interface primitive
and an inherited private primitive. In such case the inherited private
primitive is the dispatching primitive. For further details read
http://www.ada-auth.org/cgi-bin/cvsweb.cgi/ai05s/ai05-0197-1.txt

After this patch the following test compiles and executes fine.

package Pack1 is
   type Int1 is interface;
   procedure Op1 (X : Int1) is null;
end Pack1;

package Pack2 is
   type T2 is tagged null record;
private
   procedure Op1 (X : T2);
end Pack2;

with Pack1, Pack2;
package Pack2.Pack3 is
   type T3 is new Pack2.T2 and Pack1.Int1 with null record;
end Pack2.Pack3;

with Text_IO; use Text_IO;
package body Pack2 is
   procedure Op1 (X : T2) is
   begin
      Put_Line ("OK");
   end;
end Pack2;

with Pack2.Pack3;
procedure Do_Test is
   X : Pack2.Pack3.T3;
begin
   Pack2.Pack3.Op1 (X);
end;

Output:  OK

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

2010-10-26  Javier Miranda  <miranda@adacore.com>

	* sem_ch3.adb (Add_Internal_Interface_Entities): Handle primitives
	inherited from the parent that cover interface primitives.
	(Derive_Progenitor_Subprograms): Handle primitives inherited from
	the parent that cover interface primitives.
	* sem_disp.adb (Find_Primitive_Covering_Interface): When searching in
	the list of primitives of the type extend the test to include inherited
	private primitives.
	* sem_ch6.ads (Is_Interface_Conformant): Add missing documentation.
	* sem_ch7.adb (Declare_Inherited_Private_Subprograms): Add missing
	barrier to the loop searching for explicit overriding primitives.
	* sem_ch4.adb (Analyze_Indexed_Component_Form): Add missing barrier
	before accessing attribute Entity.

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]