Comments
Patch
===================================================================
@@ -12966,8 +12966,16 @@ package body Sem_Ch3 is
-- were not covered by the parent type. We exclude here null
-- interface primitives because they do not need special
-- management.
+ -- We also exclude interface operations that are renamings.
+ -- If the subprogram is an explicit renaming of an interface
+ -- primitive, it is a regular primitive operation, and the
+ -- presence of its alias is not relevant: it has to be derived
+ -- like any other primitive.
elsif Present (Alias (Subp))
+ and then
+ Nkind (Unit_Declaration_Node (Subp))
+ /= N_Subprogram_Renaming_Declaration
and then Is_Interface (Find_Dispatching_Type (Alias_Subp))
and then not
(Nkind (Parent (Alias_Subp)) = N_Procedure_Specification
If the parent subprogram in a type derivation is an explicit renaming of an interface primitive, it is a regular primitive operation, and the presence of its alias is not relevant: it has to be derived like any other primitive. The following must compile quietly: gcc -c -gnat05 p2.ads --- package P1 is type I1 is limited interface; procedure P (Self : not null access I1) is abstract; procedure H (Self : not null access I1) renames P; end P1; --- with P1; package P2 is type T1 is limited new P1.I1 with private; private type T1 is limited new P1.I1 with null record; overriding procedure P (Self : not null access T1) is null; overriding procedure H (Self : not null access T1) is null; end P2; Tested on x86_64-pc-linux-gnu, committed on trunk 2010-09-10 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb (Derive_Subprograms): An interface primitive operation that is a renaming must be derived like any other primitive operation, the renamed operation is not relevant to the derivation.