CVS difference for ai05s/ai05-0050-1.txt
--- ai05s/ai05-0050-1.txt 2008/10/25 04:53:14 1.6
+++ ai05s/ai05-0050-1.txt 2008/12/02 06:01:19 1.7
@@ -1,5 +1,7 @@
-!standard 6.5(24/2) 08-10-15 AI05-0050-1/05
+!standard 6.5(24/2) 08-11-18 AI05-0050-1/06
!class binding interpretation 07-05-04
+!status Amendment 201Z 08-11-26
+!status ARG Approved 7-0-0 08-11-02
!status work item 07-05-04
!status received 07-04-20
!priority Medium
@@ -51,7 +53,8 @@
with
For a function call used to initialize a composite object with a constrained
- nominal subtype:
+ nominal subtype or used to initialize a return object that is built in place
+ into such an object:
- If the result subtype of the function is constrained, and conversion of
an object of this subtype to the subtype of the object being initialized
@@ -65,10 +68,22 @@
Constraint_Error may be raised at the point of the call (after abandoning
the execution of the function body).
- AARM Notes
+[Editor's note: The definition of "built in place" was added by AI05-0067-1.]
+
+AARM Reason:
+
+ Without such a permission, it would be very difficult to implement "built-in-place"
+ semantics. The intention is that the exception is raised at same point that it
+ would have been raised without the permission; it should not change handlers if the
+ implementation switches between return-by-copy and built-in-place. This means
+ that the exception is not handleable within the function, because in the
+ return-by-copy case, the constraint check to verify that the result satisfies the
+ constraints of the object being initialized happens after the function returns.
+ This implies further that upon detecting such a situation, the implementation
+ may need to simulate a goto to a point outside any local exception handlers prior
+ to raising the exception.
- These permissions apply transitively in the case of a function call
- which returns the value of another function call.
+AARM Ramification:
These permissions do not apply in the case of an extended
return object with mutable discriminants. That's necessary because in that
@@ -84,13 +99,13 @@
and then a return statement with the "right" discrimiants or bounds is executed.
The only solution for this problem is not have the permission at all, but this is
too unusual of a case to worry about the effects of the permission, especially
- given the implementation difficulties for build-in-place objects that this
+ given the implementation difficulties for built-in-place objects that this
permission is intended to ease.
Note that the mutable-discriminant case only happens when
build-in-place initialization is optional. This means that any difficulties
- associated with implementing build-in-place initialization without these
- permissions can be sidestepped by not building-in-place.
+ associated with implementing built-in-place initialization without these
+ permissions can be sidestepped by not building in place.
!discussion
@@ -305,6 +320,33 @@
This cannot be avoided without dropping the permission completely; but that would
have an unacceptable implementation cost for build-in-place objects. (Rec in the
example above could be a type that requires build-in-place.)
+
+!corrigendum 6.5(24/2)
+
+@drepl
+If the result subtype of a function is unconstrained, and a call on the function is
+used to provide the initial value of an object with a constrained nominal subtype,
+Constraint_Error may be raised at the point of the call (after abandoning the
+execution of the function body) if, while elaborating the @fa<return_subtype_indication>
+or evaluating the @fa<expression> of a return statement that applies to the
+function body, it is determined that the value of the result will violate the
+constraint of the subtype of this object.
+@dby
+For a function call used to initialize a composite object with a constrained
+nominal subtype or used to initialize a return object that is built in place
+into such an object:
+
+@xbullet<If the result subtype of the function is constrained, and conversion of
+an object of this subtype to the subtype of the object being initialized
+would raise Constraint_Error, then Constraint_Error may be raised before
+calling the function.>
+
+@xbullet<If the result subtype of the function is unconstrained, and a return
+statement is executed such that the return object is known to be
+constrained, and conversion of the return object to the subtype of the
+object being initialized would raise Constraint_Error, then
+Constraint_Error may be raised at the point of the call (after abandoning
+the execution of the function body).>
!ACATS test
Questions? Ask the ACAA Technical Agent