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] Inheritance of private null interface primitive


A derived type does not inherit a private operation from a parent type,
but can dispatch to it. That is, its dispatch table includes a full
copy of the dispatch table of the parent, even if some of its entries
can never be named. After this patch the following test compiles
and executes silently.

package R is
   type I1 is interface;
   procedure Oper (Obj : I1'Class);
private
   procedure Proc (Obj : I1) is null;
end R;

package body R is
   procedure Oper (Obj : I1'Class) is
   begin
      Obj.Proc; -- Dispatching
   end Oper;
end;

with R;
package P1 is
   type Root is tagged private;
private
   type Root is tagged null record;
end;

with P1; with R;
package Q1 is
   type Child is new P1.Root and R.I1 with null record;
end Q1;

with P1, Q1, R;
procedure Main1 is
   X : Q1.Child;
begin
   R.Oper (X);
end Main1;

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

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

	* sem_ch3.adb (Add_Internal_Interface_Entities): Code reorganization:
	move code that searches in the list of primitives of a tagged type for
	the entity that will be overridden by user-defined routines.
	* sem_disp.adb (Find_Primitive_Covering_Interface): Move here code
	previously located in routine Add_Internal_Interface_Entities.
	* sem_disp.ads (Find_Primitive_Covering_Interface): Update documentation
	* sem_ch6.adb (New_Overloaded_Entity): Add missing check on
	availability of attribute Alias.

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]