exp_intr.adb (Expand_Unc_Deallocation): If the designated type is controlled...

2005-07-04  Ed Schonberg  <schonberg@adacore.com>

	* exp_intr.adb (Expand_Unc_Deallocation): If the designated type is
	controlled, indicate the expected type of the dereference that is
	created for the call to Deep_Finalize, to prevent spurious errors when
	the designated type is private and completed with a derivation from
	another private type.

From-SVN: r101579
This commit is contained in:
Ed Schonberg 2005-07-04 15:28:00 +02:00 committed by Arnaud Charlet
parent 64dd539571
commit 4a2ddf6697
1 changed files with 10 additions and 1 deletions

View File

@ -664,12 +664,21 @@ package body Exp_Intr is
-- If the type is tagged, then we must force dispatching on the
-- finalization call because the designated type may not be the
-- actual type of the object
-- actual type of the object.
if Is_Tagged_Type (Desig_T)
and then not Is_Class_Wide_Type (Desig_T)
then
Deref := Unchecked_Convert_To (Class_Wide_Type (Desig_T), Deref);
elsif not Is_Tagged_Type (Desig_T) then
-- Set type of result, to force a conversion when needed (see
-- exp_ch7, Convert_View), given that Deep_Finalize may be
-- inherited from the parent type, and we need the type of the
-- expression to see whether the conversion is in fact needed.
Set_Etype (Deref, Desig_T);
end if;
Free_Cod :=