CVS difference for ais/ai-00168.txt

Differences between 1.11 and version 1.12
Log of other versions for file ais/ai-00168.txt

--- ais/ai-00168.txt	1999/11/19 00:43:43	1.11
+++ ais/ai-00168.txt	2000/03/07 22:17:12	1.12
@@ -1,4 +1,4 @@
-!standard 04.06    (12)                               99-10-06  AI95-00168/05
+!standard 04.06    (12)                               00-02-25  AI95-00168/06
 !standard 03.07.01 (07)
 !class binding interpretation 96-11-16
 !status Corrigendum 2000 99-07-27
@@ -16,9 +16,9 @@
 A view conversion of an array object is illegal if the target subtype and
 the operand do not have both aliased components or both non-aliased components.
 
-A discriminant constraint for a general access type is illegal if the
-designated subtype is a private type with default discriminants, but the
-partial view has no discriminants.
+A discriminant constraint for a general access type is illegal if there are
+places where the designated subtype appears constrained and others where it
+appears unconstrained.
 
 !question
 
@@ -67,12 +67,11 @@
 shall either both have aliased components, or both have non-aliased
 components.
 
-Add the following clause after RM95 3.7.1(7):
+Add the following sentence at the end of RM95 3.7.1(7):
 
-A discriminant_constraint is not allowed in a subtype_indication whose
-subtype_mark denotes a general access subtype whose designated subtype is a
-private type with defaulted discriminants, if the partial view of the private
-type has no discriminants.
+However, in the case of a general access subtype, a discriminant_constraint is
+illegal if there are places within the immediate scope of the designated
+subtype where it appears to be a constrained subtype.
 
 !discussion
 
@@ -80,7 +79,8 @@
 conversion to convert an array object with aliased components to an array type
 with non-aliased components.  Such a conversion must be disallowed.
 
-At an ARG meeting, the following case was also discussed:
+The ARG also discussed the following example, which illustrates another case
+where the RM seems to allow a discriminant to be changed:
 
   with Q;
   package body P is
@@ -89,14 +89,24 @@
      Q.X := (others => (D => 2)); -- Changes the discriminant of Q.X (2)
   end P;
 
-The root of problem (2) is that the partial view of P.T is constrained, but
-the full view isn't.  This causes privacy problems when applying the
+The root of problem (2) is that there are places (e.g., the visible part of P)
+where P.T is constrained, but other places (e.g., the private part and body of
+P) where P.T is unconstrained.  This causes privacy problems when applying the
 following rule:
 
 "if a component_definition contains the reserved word aliased and the type of
 the component is discriminated, then the nominal subtype of the component
 shall be constrained." (RM95 3.6(11))
 
+Also note that the problem exists with non-private types, provided that the
+characteristic that the type is unconstrained is not visible everywhere:
+
+  package P.C is
+     type NT is new T;
+  private
+     type Ptr is access all NT; -- Causes the same problems as P.Ptr.
+  end P.C;
+
 One way to fix this problem would be to require a component-by-component check
 on the assignment to Q.X, but that would be very expensive.  Moreover, a
 compile-time check would clearly be better than a run-time check.
@@ -111,16 +121,17 @@
 !corrigendum 3.07.01(7)
 
 @drepl
-A @fa<discriminant_constraint> is only allowed in a @fa<subtype_indication> whose
-@fa<subtype_mark> denotes either an unconstrained discriminated subtype, or an
-unconstrained access subtype whose designated subtype is an unconstrained
+A @fa<discriminant_constraint> is only allowed in a @fa<subtype_indication>
+whose @fa<subtype_mark> denotes either an unconstrained discriminated subtype,
+or an unconstrained access subtype whose designated subtype is an unconstrained
 discriminated subtype.
 @dby
 A @fa<discriminant_constraint> is only allowed in a @fa<subtype_indication> whose
 @fa<subtype_mark> denotes either an unconstrained discriminated subtype, or an
 unconstrained access subtype whose designated subtype is an unconstrained
-discriminated subtype. However, in the case of a general access subtype, the
-designated subtype shall not be of a type whose partial view is constrained.
+discriminated subtype. However, in the case of a general access subtype, a
+discriminant_constraint is illegal if there are places within the immediate
+scope of the designated subtype where it appears to be a constrained subtype.
 
 !corrigendum 4.06(11)
 

Questions? Ask the ACAA Technical Agent