then
if (Etype (N) = Typ
or else (Do_Access and then Designated_Type (Typ) = S_Typ))
- and then not Is_Aliased_View (Lhs)
+ and then (No (Lhs) or else not Is_Aliased_View (Lhs))
then
return;
end if;
and then Is_Formal (Entity (N)));
end Is_Conversion_Or_Reference_To_Formal;
+ --------------------------------------------------
+ -- Is_Expanded_Class_Wide_Interface_Object_Decl --
+ --------------------------------------------------
+
+ function Is_Expanded_Class_Wide_Interface_Object_Decl
+ (N : Node_Id) return Boolean is
+ begin
+ return not Comes_From_Source (N)
+ and then Nkind (Original_Node (N)) = N_Object_Declaration
+ and then Nkind (N) = N_Object_Renaming_Declaration
+ and then Is_Class_Wide_Type (Etype (Defining_Identifier (N)))
+ and then Is_Interface (Etype (Defining_Identifier (N)))
+ and then Nkind (Name (N)) = N_Explicit_Dereference;
+ end Is_Expanded_Class_Wide_Interface_Object_Decl;
+
------------------------------
-- Is_Finalizable_Transient --
------------------------------
-- Return True if N is a type conversion, or a dereference thereof, or a
-- reference to a formal parameter.
+ function Is_Expanded_Class_Wide_Interface_Object_Decl
+ (N : Node_Id) return Boolean;
+ -- Determine if N is the expanded code for a class-wide interface type
+ -- object declaration.
+
function Is_Finalizable_Transient
(Decl : Node_Id;
N : Node_Id) return Boolean;
then
return Is_Aliased_View (Expression (Obj));
+ elsif Is_Expanded_Class_Wide_Interface_Object_Decl (Parent (Obj)) then
+ return Is_Aliased
+ (Defining_Identifier (Original_Node (Parent (Obj))));
+
-- The dereference of an access-to-object value denotes an aliased view,
-- but this routine uses the rules of the language so we need to exclude
-- rewritten constructs that introduce artificial dereferences.