CVS difference for ais/ai-00216.txt

Differences between 1.7 and version 1.8
Log of other versions for file ais/ai-00216.txt

--- ais/ai-00216.txt	2002/02/07 04:56:41	1.7
+++ ais/ai-00216.txt	2002/04/26 20:15:16	1.8
@@ -1,4 +1,4 @@
-!standard 03.08.01      (01)                        02-02-04  AI95-00216/06
+!standard 03.08.01      (01)                        02-04-17  AI95-00216/07
 !class amendment 99-03-23
 !status work item 99-03-23
 !status received 99-03-23
@@ -113,6 +113,14 @@
 
 !wording
 
+In paragraph B.3(60.2/1), replace
+    "a type T is eligible for convention C_Pass_By_Copy if T is a record type"
+with
+    "a type T is eligible for convention C_Pass_By_Copy if T is an
+     unchecked union type or if T is a record type".
+
+
+
 B.3.3 Pragma Unchecked_Union
 
 [A pragma Unchecked_Union specifies an interface correspondence
@@ -144,26 +152,28 @@
 If a component subtype of the type is subject to a per-object constraint,
 then the component subtype shall be an unchecked union subtype.
 
-The type shall not be a by-reference type.
+Any name which denotes a discriminant of an object of an
+unchecked union type shall occur within the declarative region of the type.
 
-                Static Semantics
+A component declared in a variant_part of an unchecked union type shall not
+have a controlled, protected, or task part.
 
-An unchecked union type is eligible for conventions C and C_Pass_By_Copy,
-as is any subtype of the type.
+The completion of an incomplete or private type declaration having a
+known_discriminant_part shall not be an unchecked union type.
 
-Discriminant_Check is suppressed for the type.
+An unchecked union subtype shall not be passed as a generic actual parameter
+if the corresponding formal type has a known_discriminant_part or
+is a formal derived type which is not an unchecked union type.
 
-All objects of the type shall have the same size.
+                Static Semantics
 
-Discriminants of objects of the type shall be of size zero.
+An unchecked union type is eligible for convention C.
+
+Discriminant_Check is suppressed for the type.
 
-Any name which denotes a discriminant of an Unchecked_Union type shall occur
-within the declarative region of the type, the component_choice_list of an
-aggregate, or the selector_name of a discriminant_constraint.
+All objects of the type have the same size.
 
-An Unchecked_Union subtype shall not be passed as a generic actual parameter
-if the corresponding formal type has a known_discriminant_part or
-is a formal derived type which is not an unchecked union type.
+Discriminants of objects of the type are of size zero.
 
                 Dynamic Semantics
 
@@ -173,29 +183,32 @@
 enclosing unchecked union object which is subject to a per-object constraint
 and the enclosing object lacks inferable discriminants.
 
-An expression of an Unchecked_Union type is said to have "inferable
+An expression of an unchecked union type is said to have "inferable
 discriminants" if it is either a name of an object with inferable discriminants
 or a qualified expression whose subtype_mark denotes a constrained subtype.
+
+Program_Error is raised in the following cases:
+
+    Evaluation of the predefined equality operator for an unchecked union type
+    if either of the operands lacks inferable discriminants. [This includes the
+    case where the equality operator is invoked implicitly by the equality
+    operator for an enclosing composite type - if the unchecked union
+    component subtype is unconstrained, Program_Error is raised].
+
+    Evaluation of a membership test if the subtype_mark denotes a constrained
+    unchecked union subtype and the expression lacks inferable discriminants.
+
+    Conversion from a derived unchecked union type to an unconstrained
+    non-unchecked-union type if the operand of the conversion lacks inferable
+    discriminants.
+
+    Execution of the default implementation of the Write or Read attribute
+    of an unchecked union type.
 
-The predefined equality operator for an Unchecked_Union type raises
-Program_Error if either of the operands lacks inferable discriminants. [This
-includes the case where the equality operator is invoked implicitly by the
-equality operator for an enclosing composite type - if the Unchecked_Union
-component is unconstrained, Program_Error is raised].
-
-Evaluation of a membership test raises Program_Error if the subtype_mark
-denotes a constrained Unchecked_Union subtype and the expression lacks
-inferable discriminants.
-
-Conversion from an Unchecked_Union type to an unconstrained non-Unchecked_Union
-type raises Program_Error if the operand of the conversion lacks inferable
-discriminants.
-
-Unless overridden by an attribute_definition_clause, execution of the Write or
-Read attribute of an Unchecked_Union type raises Program_Error. The same holds
-for the Output and Input attributes if the type lacks default discriminant
-values.
+    Execution of the default implementation of the Output or Input attribute
+    of an unchecked union type if the type lacks default discriminant values.
 
+
 !example
 
 Given the C type:
@@ -730,6 +743,178 @@
 
 You just say that Unsuppress unsupresses checks previously suppressed by
 Suppress, then that does not include the unchecked union stuff.
+
+*************************************************************
+
+From: Steve Baird
+Sent: Tuesday, March 26, 2002 at  6:33 PM
+
+The following revised wording for AI-216 incorporates the
+suggestions that were made at the Cupertino ARG meeting.
+
+   -- Steve
+
+----
+
+B.3(60.2/1) - replace
+    "a type T is eligible for convention C_Pass_By_Copy if T is a record type"
+with
+    "a type T is eligible for convention C_Pass_By_Copy if T is an
+     unchecked union type or if T is a record type".
+
+The resulting paragraph reads:
+    The eligibility rules in B.1 do not apply to convention C_Pass_By_Copy.
+    Instead, a type T is eligible for convention C_Pass_By_Copy if
+    T is an unchecked union type or if T is a record type that has no
+    discriminants and that only has components with statically constrained
+    subtypes, and each component is C-compatible.
+
+----
+
+
+B.3.3 Pragma Unchecked_Union
+
+[A pragma Unchecked_Union specifies an interface correspondence
+between a given discriminated type and some C union. The pragma
+specifies that the associated type shall be given a representation
+that leaves no space for its discriminant(s).]
+
+                Syntax
+
+The form of pragma Unchecked_Union is as follows:
+
+    pragma Unchecked_Union (first_subtype_local_name);
+
+                Legality Rules
+
+Unchecked_Union is a representation pragma, specifying the unchecked
+union aspect of representation.
+
+The first_subtype_local_name of a pragma Unchecked_Union shall denote
+an unconstrained discriminated record subtype having a variant_part.
+
+The type is said to be an unchecked union type. A subtype of an
+unchecked union type is said to be an unchecked union subtype.
+An object of an unchecked union type is said to be an unchecked union
+object.
+
+All component subtypes of the type shall be C-compatible.
+
+If a component subtype of the type is subject to a per-object constraint,
+then the component subtype shall be an unchecked union subtype.
+
+Any name which denotes a discriminant of an object of an
+unchecked union type shall occur within the declarative region of the type.
+
+The completion of an incomplete or private type declaration having a
+known_discriminant_part shall not be an unchecked union type.
+
+An unchecked union subtype shall not be passed as a generic actual parameter
+if the corresponding formal type has a known_discriminant_part or
+is a formal derived type which is not an unchecked union type.
+
+                Static Semantics
+
+An unchecked union type is eligible for convention C.
+
+Discriminant_Check is suppressed for the type.
+
+All objects of the type have the same size.
+
+Discriminants of objects of the type are of size zero.
+
+                Dynamic Semantics
+
+A view of an unchecked union object [(including a type conversion or
+function call)] is said to have "inferable discriminants" if it has a
+constrained nominal subtype, unless the object is a component of an
+enclosing unchecked union object which is subject to a per-object constraint
+and the enclosing object lacks inferable discriminants.
+
+An expression of an unchecked union type is said to have "inferable
+discriminants" if it is either a name of an object with inferable discriminants
+or a qualified expression whose subtype_mark denotes a constrained subtype.
+
+Program_Error is raised in the following cases:
+
+    Evaluation of the predefined equality operator for an unchecked union type
+    if either of the operands lacks inferable discriminants. [This includes the
+    case where the equality operator is invoked implicitly by the equality
+    operator for an enclosing composite type - if the unchecked union
+    component subtype is unconstrained, Program_Error is raised].
+
+    Evaluation of a membership test if the subtype_mark denotes a constrained
+    unchecked union subtype and the expression lacks inferable discriminants.
+
+    Conversion from a derived unchecked union type to an unconstrained
+    non-unchecked-union type if the operand of the conversion lacks inferable
+    discriminants.
+
+    Execution of the default implementation of the Write or Read attribute
+    of an unchecked union type.
+
+    Execution of the default implementation of the Output or Input attribute
+    of an unchecked union type if the type lacks default discriminant values.
+
+*************************************************************
+
+From: Randy Brukardt
+Sent: Wednesday, April 17, 2002 at  7:18 PM
+
+> The following revised wording for AI-216 incorporates the
+> suggestions that were made at the Cupertino ARG meeting.
+
+This revised wording is missing a rule mentioned in the minutes:
+
+  Steve (Baird) points out that we can't handle finalization here (because we
+  can't know whether a controlled component exists or not, so we can't
+  implement the as-if semantics), so that has to be disallowed. Therefore,
+  replace the rule with "The type shall not have a controlled part."
+
+I've added the following to the Legality Rules section of the AI (along with Steve's other changes):
+
+   An unchecked union type shall not have a controlled part.
+
+(The slight wording change is simply to make the rule make sense in context.)
+
+*************************************************************
+
+From: Randy Brukardt
+Sent: Thursday, April 18, 2002 at 11:05 PM
+
+> This revised wording is missing a rule mentioned in the minutes:
+
+An out of band discussion on this rule has covered the following points:
+
+C-compatibility doesn't quite do the job here. We shouldn't make it
+impossible for an implementation to support controlled types as C-compatible
+(some C++ types make most naturally map to controlled types), so a separate
+rule has value.
+
+If we have a separate rule, we should include everything that has
+finalization semantics (i.e. protected types and tasks), because there
+doesn't seem to be any reason to play favorites here. Omitting one or both
+of them will just look weird.
+
+The rule really only needs to cover components declared in a variant_part
+(not the object as a whole, not any non-variant components). However, that
+is a somewhat harder wording problem, and it is unclear that it is worth it.
+
+The wording to limit the rule's coverage to just variants would be something
+like:
+
+A component declared in a variant_part of an unchecked union type shall not
+have a controlled, protected, or task part.
+
+('Part' here is the technical term defined in 3.2(6), which covers the
+component itself and any subcomponents.)
+
+Ignoring the variant_part issue gives us:
+
+An unchecked union type shall not have a controlled, protected, or task
+subcomponent.
+
+which may be easier to implement. But the first rule is what's required.
 
 *************************************************************
 

Questions? Ask the ACAA Technical Agent