Contents Index Search Previous Next
8.5.1 Object Renaming Declarations
is used to rename an object.
: subtype_mark renames object_name
Name Resolution Rules
The type of the object_name
shall resolve to the type determined by the subtype_mark.
The renamed entity shall be an object.
The renamed entity shall not be a subcomponent
that depends on discriminants of a variable whose nominal subtype is
unconstrained, unless this subtype is indefinite, or the variable is
aliased. A slice of an array shall
not be renamed if this restriction disallows renaming of the array. In
addition to the places where Legality Rules normally apply, these rules
apply also in the private part of an instance of a generic unit. These
rules also apply for a renaming that appears in the body of a generic
unit, with the additional requirement that even if the nominal subtype
of the variable is indefinite, its type shall not be a descendant of
an untagged generic formal derived type.
declares a new view of the renamed object whose properties are identical
to those of the renamed view. Thus, the properties of the renamed object
are not affected by the renaming_declaration.
In particular, its value and whether or not it is a constant are unaffected;
similarly, the constraints that apply to an object are not affected by
renaming (any constraint implied by the subtype_mark
of the object_renaming_declaration
Example of renaming
L : Person renames Leftmost_Person; -- see 3.10.1
L.Age := L.Age + 1;
Contents Index Search Previous Next Legal