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] Handle non-default C++ constructors with anonymous access types


This patch adds the missing support for importing C++ non-default
constructors that have anonymous access type formals. The following
test now compiles without errors:

with Interfaces.C; use Interfaces.C;
package file_cpp is
   package Class_Base is
      type Base is tagged limited record
         My_V : aliased int;
      end record;
      pragma Import (CPP, Base);

      type Base_Access is access all Base'Class;

      procedure Primitive (this : access Base);
      pragma Import (CPP, Primitive, "_ZN4Base9PrimitiveEv");

      function New_Base return Base;
      pragma CPP_Constructor (New_Base, "_ZN4BaseC1Ev");
   end;
   use Class_Base;
   procedure Dispatch (B : access Base);
   pragma Import (CPP, Dispatch, "_Z8DispatchP4Base");
end file_cpp;

with file_cpp; use file_cpp;
  use file_cpp.Class_Base;
procedure Main is
   V : Base_Access := new Base;
begin
   V.My_V := 9;

   Primitive (V);
   Dispatch (V);
end Main;

Command: gcc -c -gnat05 main.adb

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

2009-07-20  Javier Miranda  <miranda@adacore.com>

	* exp_tss.adb (Init_Proc): Add missing support for non-default C++
	constructors that have anonymous access type formals.

	* sem_res.adb (Resolve_Actuals): Disable checks associated with Ada
	class-wide arguments in case of imported C++ subprograms.

	* exp_ch3.adb (Build_Initialization_Call): Add assertion.

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]