CVS difference for ai05s/ai05-0008-1.txt
--- ai05s/ai05-0008-1.txt 2006/03/18 07:38:01 1.1
+++ ai05s/ai05-0008-1.txt 2006/03/23 03:30:57 1.2
@@ -1,4 +1,4 @@
-!standard 3.10.2(26/2) 06-03-17 AI05-0008-1/01
+!standard 3.10.2(26/2) 06-03-18 AI05-0008-1/02
!standard 4.1(9)
!standard 8.5.1(5/2)
!class binding interpretation 06-03-17
@@ -68,14 +68,114 @@
!wording
-(TBD.)
+Replace 3.10.2(26/2):
+ The view 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 constrained by its initial
+ value.
+
+ with the following:
+
+ The view shall not be a subcomponent that depends on discriminants
+ of an enclosing composite object (view) C whose nominal subtype is
+ unconstrained, unless C is known to be constrained by its initial value,
+ as follows:
+
+ * the subtype of C is indefinite;
+
+ * C is part of a stand-alone constant (including a generic formal
+ object of mode IN);
+
+ * C is a stand-alone variable constrained by its initial value; or
+
+ * C is a dereference of a pool-specific access type, and there is
+ no partial view of the type of C that is constrained.
+
+ AARM NOTE: We disallow dereferences of general access types because
+ they might denote stand-alone aliased unconstrained variables.
+
+ 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. For the
+ purposes of determining within a generic body whether C is known to be
+ constrained by its initial value, a subtype is not considered indefinite if
+ it is a descendant of an untagged generic formal derived type, nor is an
+ access type considered pool-specific if it is a descendant of a formal access
+ type.
+
+Modify 4.1(9) as follows:
+
+ If the type of the name in a dereference is some access-to-object type T,
+ then the dereference denotes a view of an object, the nominal subtype of the
+ view being the designated subtype of T. {If the designated subtype has
+ unconstrained discriminants, the (actual) subtype of the view is constrained
+ by the values of the discriminants of the designated object, except when
+ there is a partial view of the type of the designated subtype that does not
+ have discriminants, in which case the dereference is not constrained by its
+ discriminant values.}
+
+ AARM NOTE (added after the Ada 95 ones):
+ The last sentence is different from Ada 95; it is necessary because general
+ access types can designated unconstrained objects in Ada 2005 (that was not
+ possible in Ada 95). Thus, the rules that had this effect in Ada 95 (the object
+ being constrained by its initial value) don't work in Ada 2005 and we have to
+ say this explicitly.
+
+ The "except" part of the last sentence prevents privacy "breaking", so that
+ if a private type has discriminants only in the full view, they don't
+ interfere with freely interassigning values between objects the type, even
+ when the objects live in the heap.
+
+ Retain the AARM note 4.1(9.d/2) from Draft 16 of the Ada 2005 AARM.
+
+Replace 8.5.1(5/2):
+
+ 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 constrained by its initial value. 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.
+
+ with the following:
+
+ The renamed entity shall not be a subcomponent that depends on discriminants
+ of an enclosing composite object (view) C whose nominal subtype is
+ unconstrained, unless C is known to be constrained by its initial value,
+ as follows:
+
+ * the subtype of C is indefinite;
+
+ * C is part of a stand-alone constant (including a generic formal
+ object of mode IN);
+
+ * C is a stand-alone variable constrained by its initial value; or
+
+ * C is a dereference of a pool-specific access type, and there is
+ no partial view of the type of C that is constrained.
+
+ AARM NOTE: We disallow dereferences of general access types because
+ they might denote stand-alone aliased unconstrained variables.
+
+ A slice of an array shall not be renamed if these rules disallow 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.
+ For the purposes of determining within a generic body whether C is known to
+ be constrained by its initial value, a subtype is not considered indefinite
+ if it is a descendant of an untagged generic formal derived type, nor is an
+ access type considered pool-specific if it is a descendant of a formal access
+ type.
+
!discussion
3.10.2(26/2) and 8.5.1(5/2) are not really wrong, because they both say the operation
is illegal "unless the variable is constrained by its initial value". That's not
true here; we only know that it *might* be constrained, and that is not enough as
-legality rules require certainty. But it would be best to improve the wording so this
+legality rules require certainty. But it is best to improve the wording so this
is clear.
!ACATS test
Questions? Ask the ACAA Technical Agent