6.4.1 Parameter Associations
A parameter association defines
the association between an actual parameter and a formal parameter.
Name Resolution Rules
If the mode is
in, the actual is interpreted
as an
expression;
otherwise, the actual is interpreted only as a
name,
if possible.
Legality Rules
If the mode is
in out or
out, the actual
shall be a
name
that denotes a variable.
The type of the actual parameter associated with
an access parameter shall be convertible (see
4.6)
to its anonymous access type.
Dynamic Semantics
The actual parameter is first evaluated.
For an access parameter, the
access_definition
is elaborated, which creates the anonymous access type.
For a parameter (of any mode) that is passed by
reference (see
6.2), a view conversion of the
actual parameter to the nominal subtype of the formal parameter is evaluated,
and the formal parameter denotes that conversion.
For an
in or
in out
parameter that is passed by copy (see
6.2),
the formal parameter object is created, and the value of the actual parameter
is converted to the nominal subtype of the formal parameter and assigned
to the formal.
For an out
parameter that is passed by copy, the formal parameter object is created,
and:
For an access type, the formal parameter
is initialized from the value of the actual, without a constraint check;
For a composite type with discriminants
or that has implicit initial values for any subcomponents (see
3.3.1),
the behavior is as for an
in out parameter passed by copy.
For any other type, the formal parameter
is uninitialized. If composite, a view conversion of the actual parameter
to the nominal subtype of the formal is evaluated (which might raise
Constraint_Error), and the actual subtype of the formal is that of the
view conversion. If elementary, the actual subtype of the formal is given
by its nominal subtype.
A formal
parameter of mode
in out or
out with discriminants is constrained
if either its nominal subtype or the actual parameter is constrained.
After
normal completion and leaving of a subprogram, for each
in out
or
out parameter that is passed by copy, the value of the formal
parameter is converted to the subtype of the variable given as the actual
parameter and assigned to it.
These conversions and
assignments occur in an arbitrary order.