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] Visibility problem in private derivation with interfaces


Derivations of an abstract private types that inherit uncovered
interface primitives from its parent do not allow to perform
dispatching calls through these interface primitives. After this
patch the following test does not generate an error.

package Behaviour is
   type Iface is interface;
   function F_Iface (This : Iface) return Boolean is abstract;
end;

with Behaviour; use Behaviour;
package First_Abstraction is
   type T_First is abstract new Iface with null record;
end;

with First_Abstraction; use First_Abstraction;
package Second_Abstraction is
   type T_Second is abstract new T_First with private;
private
   type T_Second is abstract new T_First with null record;
end;

with Second_Abstraction; use Second_Abstraction;
package Proxy is
   type T_Ptr is access all T_Second'Class;
   Ptr : T_Ptr;

   Result : Boolean := Ptr.F_Iface;  --  Test
end;

Command: gcc -c -gnat05 -gnatws proxy.adb

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

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

	* sem_ch3.adb (Derive_Interface_Subprogram): New subprogram.
	(Derive_Subprograms): For abstract private types transfer to the full
	view entities of uncovered interface primitives. Required because if
	the interface primitives are left in the private part of the package
	they will be decorated as hidden when the analysis of the enclosing
	package completes (and hence the interface primitive is not visible
	for dispatching calls).

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]