Section 4: Names and Expressions 4.1.3 Selected Components
4.6 Type Conversions
Replace paragraph 5: [AI95-00330-01]
A type_conversion whose operand is the name of an object is called a view conversion if both its target type and operand type are tagged, or if it appears as an actual parameter of mode out or in out; other type_conversions are called value conversions.
by:
A type_conversion whose operand is the name of an object is called a view conversion if both its target type and operand type are tagged, or if it appears as or if it appears in a call as an actual parameter of mode out or in out; other type_conversions are called value conversions.
Replace paragraph 8: [AI95-00251-01]
If the target type is a numeric type, then the operand type shall be a numeric type. by:
In a view conversion for an untagged type, the target type shall be convertible (back) to the operand type.
Delete paragraph 9: [AI95-00246-01; AI95-00251-01]
If the target type is an array type, then the operand type shall be an array type. Further:
Delete paragraph 10: [AI95-00251-01]
• The types shall have the same dimensionality; Delete paragraph 11: [AI95-00251-01]
• Corresponding index types shall be convertible;
Delete paragraph 12: [AI95-00246-01; AI95-00251-01; AI95-00392-01]
• The component subtypes shall statically match; and
Delete paragraph 12.1: [AI95-00246-01; AI95-00251-01; AI95-00363-01]
• In a view conversion, the target type and the operand type shall both or neither have aliased components.
Delete paragraph 13: [AI95-00230-01; AI95-00251-01]
If the target type is a general access type, then the operand type shall be an access-to-object type. Further:
Delete paragraph 14: [AI95-00251-01]
• If the target type is an access-to-variable type, then the operand type shall be an access-to-variable type;
Delete paragraph 15: [AI95-00251-01]
• If the target designated type is tagged, then the operand designated type shall be convertible to the target designated type;
Delete paragraph 16: [AI95-00251-01; AI95-00363-01; AI95-00384-01]
• If the target designated type is not tagged, then the designated types shall be the same, and either the designated subtypes shall statically match or the target designated subtype shall be discriminated and unconstrained; and
Delete paragraph 17: [AI95-00251-01]
• The accessibility level of the operand type shall not be statically deeper than that of the target type. In addition to the places where Legality Rules normally apply (see 12.3), this rule applies also in the private part of an instance of a generic unit.
Delete paragraph 18: [AI95-00230-01; AI95-00251-01]
If the target type is an access-to-subprogram type, then the operand type shall be an access-to-subprogram type. Further:
Delete paragraph 19: [AI95-00251-01]
• The designated profiles shall be subtype-conformant. Delete paragraph 20: [AI95-00251-01]
• The accessibility level of the operand type shall not be statically deeper than that of the target type. In addition to the places where Legality Rules normally apply (see 12.3), this rule applies also in the private part of an instance of a generic unit. If the operand type is declared within a generic body, the target type shall be declared within the generic body.
Replace paragraph 21: [AI95-00251-01]
If the target type is not included in any of the above four cases, there shall be a type that is an ancestor of both the target type and the operand type. Further, if the target type is tagged, then either:
by:
If there is a type that is an ancestor of both the target type and the operand type, then:
• The target type shall be untagged; or Replace paragraph 23: [AI95-00251-01]
• The operand type shall be a class-wide type that covers the target type. by:
• The operand type shall be a class-wide type that covers the target type; or
• The operand and target types shall both be class-wide types and the specific type associated with at least one of them shall be an interface type.
Replace paragraph 24: [AI95-00246-01; AI95-00251-01; AI95-00392-01]
In a view conversion for an untagged type, the target type shall be convertible (back) to the operand type. by:
If there is no type that is an ancestor of both the target type and the operand type, then:
• If the target type is a numeric type, then the operand type shall be a numeric type.
• If the target type is an array type, then the operand type shall be an array type. Further:
• The types shall have the same dimensionality;
• Corresponding index types shall be convertible;
• If the component types are anonymous access types, then the accessibility level of the operand type shall not be statically deeper than that of the target type;
• Neither the target type nor the operand type shall be limited; and
• In a view conversion: if the target type has aliased components, then so shall the operand type; and the operand type shall not have a tagged, private, or volatile subcomponent.
• If the target type is universal_access, then the operand type shall be an access type.
• If the target type is a general access-to-object type, then the operand type shall be universal_access or an access-to-object type. Further, if not universal_access:
• If the target type is an access-to-variable type, then the operand type shall be an access-to- variable type;
• If the target designated type is tagged, then the operand designated type shall be convertible to the target designated type;
• If the target designated type is not tagged, then the designated types shall be the same, and either:
• the designated subtypes shall statically match; or
• the designated type shall be discriminated in its full view and unconstrained in any partial view, and one of the designated subtypes shall be unconstrained;
• The accessibility level of the operand type shall not be statically deeper than that of the target type. In addition to the places where Legality Rules normally apply (see 12.3), this rule applies also in the private part of an instance of a generic unit.
• If the target type is an access-to-subprogram type, then the operand type shall be universal_access or an access-to-subprogram type. Further, if not universal_access:
• The designated profiles shall be subtype-conformant.
• The accessibility level of the operand type shall not be statically deeper than that of the target type. In addition to the places where Legality Rules normally apply (see 12.3), this rule applies also in the private part of an instance of a generic unit. If the operand type is declared within a generic body, the target type shall be declared within the generic body.
Insert after paragraph 39: [AI95-00392-01]
• In either array case, the value of each component of the result is that of the matching component of the operand value (see 4.5.2).
the new paragraph:
• If the component types of the array types are anonymous access types, then a check is made that the accessibility level of the operand type is not deeper than that of the target type.
Replace paragraph 49: [AI95-00230-01; AI95-00231-01]
• If the target type is an anonymous access type, a check is made that the value of the operand is not null; if the target is not an anonymous access type, then the result is null if the operand value is null.
by:
• If the operand value is null, the result of the conversion is the null value of the target type. Replace paragraph 51: [AI95-00231-01]
After conversion of the value to the target type, if the target subtype is constrained, a check is performed that the value satisfies this constraint.
by:
After conversion of the value to the target type, if the target subtype is constrained, a check is performed that the value satisfies this constraint. If the target subtype excludes the null value, then a check is made that the value is not null.
Replace paragraph 61: [AI95-00230-01]
22 A ramification of the overload resolution rules is that the operand of an (explicit) type_conversion cannot be the literal null, an allocator, an aggregate, a string_literal, a character_literal, or an attribute_reference for an Access or Unchecked_Access attribute. Similarly, such an expression enclosed by parentheses is not allowed. A
qualified_expression (see 4.7) can be used instead of such a type_conversion. by:
22 A ramification of the overload resolution rules is that the operand of an (explicit) type_conversion cannot be an allocator, an aggregate, a string_literal, a character_literal, or an attribute_reference for an Access or
Unchecked_Access attribute. Similarly, such an expression enclosed by parentheses is not allowed. A qualified_expression (see 4.7) can be used instead of such a type_conversion.