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] add support for deallocation of class-wide interface objects


Tested on i686-linux, committed on trunk

Add missing support for deallocation of class-wide interface objects.
After this patch the following program compiles and executes without
errors:
--
package Graphics is
   type Facet is interface;
   type Ptr   is access all Facet'Class;
--
   type Root   is tagged null record;
   type Object is new Root and Facet with null record;
end Graphics;
--
with Ada.Unchecked_Deallocation;
with Graphics; use Graphics;
procedure Main is
   Rect : Ptr := new Object;
--
   procedure Free is new Ada.Unchecked_Deallocation (Facet'Class, Ptr);
--
begin
   Free (Rect);
end Main;
--
Command: gnatmake -gnat05 main.adb; ./main

2007-06-06  Javier Miranda  <miranda@adacore.com>

	* exp_intr.adb (Expand_Unc_Deallocation): Add missing support for
	deallocation of class-wide interface objects.
	(Expand_Dispatching_Constructor_Call): Take into account that if the
	result of the dispatching constructor is an interface type, the
	function returns a class-wide interface type; otherwise the returned
	object would be actual. The frontend previously accepted returning
	interface types because Expand_Interface_Actuals silently performed
	the management of the returned type "as if" it were a class-wide
	interface type.
	(Expand_Dispatching_Constructor_Call): Replace call to
	Make_DT_Access_Action by direct call to Make_Function_Call.

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]