procedure Finalize (Obj : in out T);
procedure Initialize (Obj : in out T);
-The three procedures have the same profile, with a single ``in out`` parameter,
-and also have the same dynamic semantics as for controlled types:
+The three procedures must be primitive operations of ``T`` and have a single
+``in out`` parameter. They need not be all specified by the aspect. If they
+are specified, they have the same dynamic semantics as for controlled types:
- ``Initialize`` is called when an object of type ``T`` is declared without
initialization expression.
procedure Initialize (Obj : in out T);
@end example
-The three procedures have the same profile, with a single @code{in out} parameter,
-and also have the same dynamic semantics as for controlled types:
+The three procedures must be primitive operations of @code{T} and have a single
+@code{in out} parameter. They need not be all specified by the aspect. If they
+are specified, they have the same dynamic semantics as for controlled types:
@quotation
end if;
Error_Msg_N
- ("finalizable primitive must be local procedure whose only formal " &
+ ("subprogram must denote primitive procedure whose only formal " &
"parameter has mode `IN OUT` and is of the finalizable type", N);
end Resolve_Finalizable_Argument;
+ ------------------------------------
+ -- Resolve_Finalization_Procedure --
+ ------------------------------------
+
function Resolve_Finalization_Procedure
(N : Node_Id;
Typ : Entity_Id)
begin
return Ekind (E) = E_Procedure
and then Scope (E) = Scope (Typ)
+ and then Is_Primitive (E)
and then Present (First_Formal (E))
and then Ekind (First_Formal (E)) = E_In_Out_Parameter
and then Etype (First_Formal (E)) = Typ