13.14 Freezing Rules
This subclause defines a place in the program text
where each declared entity becomes “frozen”. A use of an
entity, such as a reference to it by name, or (for a type) an expression
of the type, causes freezing of the entity in some contexts, as described
below. The Legality Rules forbid certain kinds of uses of an entity in
the region of text where it is frozen.
of an entity occurs at one or more places (freezing points
the program text where the representation for the entity has to be fully
determined. Each entity is frozen from its first freezing point to the
end of the program text (given the ordering of compilation units defined
This subclause also defines
a place in the program text where the profile of each declared callable
entity becomes frozen
. A use of a callable entity causes freezing
of its profile in some contexts, as described below. At the place where
the profile of a callable entity becomes frozen, the entity itself becomes
The end of a declarative_part
or a declaration of a library package or generic library package, causes
of each entity and profile declared within it, as well
as the entity itself in the case of the declaration of a library unit.
A noninstance proper_body
causes freezing of each entity and profile declared before it within
the same declarative_part
construct that (explicitly or implicitly) references an entity can cause
of the entity, as defined by subsequent paragraphs.
At the place where a construct causes freezing, each
the construct causes freezing:
The occurrence of a generic_instantiation
causes freezing, except that a name
which is a generic actual parameter whose corresponding generic formal
parameter is a formal incomplete type (see 12.5.1
does not cause freezing. In addition, if a parameter of the instantiation
is defaulted, the default_expression
for that parameter causes freezing.
At the occurrence of a renames-as-body whose callable_entity_name
denotes an expression function, the return expression of the expression
function causes freezing.
The occurrence of an object_declaration
that has no corresponding completion causes freezing.
The declaration of a record
extension causes freezing of the parent subtype.
The declaration of a record extension, interface
type, task unit, or protected unit causes freezing of any progenitor
types specified in the declaration.
At the freezing point of the entity associated
with an aspect_specification
any static expressions within the aspect_specification
cause freezing, as do expression
for representation aspects, or operational aspects that have a corresponding
operational attribute. Similarly, if an aspect_definition
for an operational aspect, other than an assertion aspect, can affect
the Name Resolution, Static Semantics, or Legality Rules of a subsequent
construct, then any expression
cause freezing at the freezing point of the associated entity. Any static
expressions within an aspect_specification
also cause freezing at the end of the immediately enclosing declaration
list. For the purposes of this rule, if there is no declared entity associated
with an aspect_specification
the freezing point is considered to occur immediately following the aspect_specification
A static expression (other than
within an aspect_specification
causes freezing where it occurs.
An object name or
nonstatic expression causes freezing where it occurs, unless the name
or expression is part of a default_expression
the return expression of an expression function, an aspect_specification
or a per-object expression of a component's constraint
in which case, the freezing occurs later as part of another construct
or at the freezing point of an associated entity.
An implicit call freezes the
same entities and profiles that would be frozen by an explicit call.
This is true even if the implicit call is removed via implementation
If an expression is implicitly
converted to a type or subtype T
, then at the place where the
expression causes freezing, T
The following rules
define which entities are frozen at the place where a construct causes
place where a function call causes freezing, the profile of the function
is frozen. Furthermore, if a parameter of the call is defaulted, the
for that parameter causes freezing. If the function call is to an expression
function, the return expression of the expression function causes freezing.
place where a generic_instantiation
causes freezing of a callable entity, the profile of that entity is frozen
unless the formal subprogram corresponding to the callable entity has
a parameter or result of a formal untagged incomplete type; if the callable
entity is an expression function, the return expression of the expression
function causes freezing.
At the place where a use of
the Access or Unchecked_Access attribute whose prefix
denotes an expression function causes freezing, the return expression
of the expression function causes freezing.
the place where a name
causes freezing, the entity denoted by the name
is frozen, unless the name
is a prefix
of an expanded name;
at the place where an object
freezing, the nominal subtype associated with the name
the place where a range
causes freezing, the type of the range
the place where an allocator
causes freezing, the designated subtype of its type is frozen. If the
type of the allocator
is a derived type, then all ancestor types are also frozen.
the place where a profile is frozen, each subtype of the profile is frozen.
If the corresponding callable entity is a member of an entry family,
the index subtype of the family is frozen.
At the place where a subtype
is frozen, its type is frozen.
the place where a type is frozen, any expressions or name
within the full type definition cause freezing, other than those that
occur within an access_type_definition
or an access_definition
the first subtype, and any component subtypes, index subtypes, and parent
subtype of the type are frozen as well.
a specific tagged type, the corresponding class-wide type is frozen as
well. For a class-wide type, the corresponding specific type is frozen
At the place where
a specific tagged type is frozen, the primitive subprograms of the type
are frozen. At the place where a type is frozen, any subprogram named
in an attribute_definition_clause
for the type is frozen.
At the place where a construct causes freezing,
if the construct includes a check associated with some assertion aspect
(independent of whether the check is enabled), or depends on the definition
of some operational aspect as part of its Dynamic Semantics, any name
in the aspect_definition
for the aspect cause freezing.
Notwithstanding the rest of this subclause, freezing
an incomplete view has no effect.
The explicit declaration
of a primitive subprogram of a tagged type shall occur before the type
is frozen (see 3.9.2
A type shall be completely
defined before it is frozen (see 3.11.1
The completion of a
deferred constant declaration shall occur before the constant is frozen
An operational or representation
item that directly specifies an aspect of an entity shall appear before
the entity is frozen (see 13.1
The tag (see 3.9
) of a
tagged type T is created at the point where T is frozen.
Ada 2005 and 2012 Editions sponsored in part by Ada-Europe