CVS difference for ais/ai-00326.txt

Differences between 1.4 and version 1.5
Log of other versions for file ais/ai-00326.txt

--- ais/ai-00326.txt	2003/08/01 01:40:08	1.4
+++ ais/ai-00326.txt	2003/09/18 22:42:37	1.5
@@ -19,7 +19,7 @@
 
 A concept of a "tagged incomplete" type is introduced, which is a type that has
 the same restrictions as an incomplete type except that it may also be used for
-a formal parameter.
+a formal or actual parameter.
 
 !problem
 
@@ -43,13 +43,14 @@
 If the words IS TAGGED appear, the type is a tagged incomplete type. Otherwise,
 the type is a non-tagged incomplete type. In addition to places where a
 (non-tagged) incomplete type may be used, a tagged incomplete type may be used
-as a formal parameter type. The attribute 'Class is defined for
-(specific) tagged incomplete types. (The use of 'Class with non-tagged
-incomplete types is considered obsolescent; such non-tagged incomplete types
-must be completed with a tagged type.) The class-wide type denoted by the Class
-attribute of an incomplete tagged type is also an incomplete tagged type. An
-incomplete tagged type declaration must be completed by a tagged type
-declaration.
+as a formal parameter type, and a dereference of an access to tagged incomplete
+can be used as an actual parameter for a class-wide tagged incomplete formal
+parameter. The attribute 'Class is defined for (specific) tagged incomplete
+types. (The use of 'Class with non-tagged incomplete types is considered
+obsolescent; such non-tagged incomplete types must be completed with a tagged
+type.) The class-wide type denoted by the Class attribute of an incomplete
+tagged type is also an incomplete tagged type. An incomplete tagged type
+declaration must be completed by a tagged type declaration.
 
 
 !wording
@@ -90,13 +91,17 @@
           Class; such an attribute_reference is restricted to the uses allowed
           above.
 
-Replace 3.10.1(11):
+Replace 3.10.1(10):
 
         An incomplete_type_declaration declares an incomplete type and its
-        first subtype; the incomplete type is tagged if the keyword TAGGED
-        appears; the first subtype is unconstrained if a
-        known_discriminant_part appears.
 
+Replace 3.10.1(11):
+
+        A dereference (whether implicit or explicit -- see 4.1) shall not be
+        of an incomplete type, unless it is directly used as an actual
+        parameter where the expected type is a class-wide tagged incomplete
+        type.
+
 Add J.11:
 
    J.11 The Class Attribute of Non-tagged Incomplete Types
@@ -129,6 +134,38 @@
 result coupled with tag indeterminacy, finalization associated with returning
 potentially controlled types, etc.).
 
+Similarly, we are not allowing an incomplete tagged type to be dereferenced
+(and thus used as an actual parameter) in most cases, because doing so may
+require the reading of the tag and/or discriminants, whose positions are not
+known. However, we are allowing such a use as an actual parameter of a
+class-wide tagged incomplete type, as such objects are passed by reference
+with no need to read any portion of them.
+
+For instance:
+
+      package Typ is
+          type T is tagged;
+          type AT is access all T;
+          procedure Op1 (Obj : in out T'Class);
+          procedure Op2 (Obj : in out T);
+          ...
+      end Typ;
+
+      with Typ;
+      procedure User is
+          ...
+          P : Typ.AT := ...;
+          ...
+          Typ.Op1 (P.all); -- OK.
+          Typ.Op2 (P.all); -- Can't allow (don't know where the tag is).
+          ...
+      end User;
+
+Note that Op1 could be used as a work-around to implement Op2 if that was
+necessary (as the body of Typ.Op1 certainly could dispatch to Op2; it can
+see the completing type).
+
+
 !example
 
 !corrigendum 3.10.1(2)
@@ -194,6 +231,16 @@
 @fa<attribute_designator> is Class; such an @fa<attribute_reference> is
 restricted to the uses allowed above.>
 
+!corrigendum 3.10.1(10)
+
+@drepl
+A dereference (whether implicit or explicit -- see 4.1) shall not be
+of an incomplete type.
+@dby
+A dereference (whether implicit or explicit -- see 4.1) shall not be
+of an incomplete type, unless it is directly used as an actual
+parameter where the expected type is a class-wide tagged incomplete type.
+
 !corrigendum 3.10.1(11)
 
 @drepl
@@ -528,6 +575,35 @@
 but it has to depend on an existing discriminant.  So as far as the
 compiler is concerned there is no difference between a subtype of a
 derived (tagged) type and a subtype of the parent.
+
+*************************************************************
+
+From: Randy Brukardt
+Sent: Wednesday, September 17, 2003  2:05 PM
+
+I'm working on the wording for tagged incomplete types, and I need a bit of
+help.
+
+The Standard makes it clear that an incomplete type is a separate type from
+the completion. (This is very different than the situation for private
+types. This formulation was inherited from Ada 83.) But that doesn't seem to
+be reflected in the type matching rules.
+
+For instance: (I've marked the incomplete type with an [I] and the complete
+type with a [C] for clarity)
+
+     type D[I];
+     type Acc_D is access all D[I];
+     type D[C] is ...;
+
+     P : Acc_D := new D[C];
+
+Where is the rule that says that D[C] is allowed to match D[I] for
+resolution purposes?
+
+Now, we all *know* this works. The question is merely where does the RM say
+that. If it doesn't, of course, we have another hole to fix, which should be
+taken into account when writing the wording.
 
 *************************************************************
 

Questions? Ask the ACAA Technical Agent