CVS difference for ais/ai-00161.txt

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

--- ais/ai-00161.txt	1999/03/13 01:36:17	1.7
+++ ais/ai-00161.txt	1999/09/23 18:39:38	1.8
@@ -1,4 +1,4 @@
-!standard 10.02.01 (09)                               99-03-12  AI95-00161/04
+!standard 10.02.01 (09)                               99-09-23  AI95-00161/05
 !class binding interpretation 99-02-23
 !status work item 98-04-16
 !status received 96-09-10
@@ -6,16 +6,16 @@
 !difficulty Medium
 !subject Default-initialized objects
 
-!summary 99-02-23
+!summary
 
-The creation of an object whose nominal subtype has preelaborable
-initialization is allowed in a preelaborable unit.  This makes it possible to
-declare objects of some private types in preelaborable units.
+The creation of an object whose type has preelaborable initialization is allowed
+in a preelaborable unit.  This makes it possible to declare objects of some
+private types in preelaborable units.
 
-The notion of a subtype having "preelaborable initialization" is defined by
+The notion of a type having "preelaborable initialization" is defined by
 this AI.
 
-!question 99-02-23
+!question
 
 The paragraphs RM95 10.2.1(5-9) list a number of constructs which are
 forbidden in preelaborable units.  In particular, RM95 10.2.1(9) states that:
@@ -36,85 +36,72 @@
 Null_Unbounded_String would have to include an extension aggregate for
 a controlled type, which is illegal in a preelaborable unit.
 
-!recommendation 98-04-16
+!recommendation
 
 (See wording.)
 
-!wording 99-03-12
+!wording
 
 Change the RM95 10.2.1(9) to read:  "The creation of an object (including a
-component) of a subtype which does not have preelaborable initialization.
+component) of a type which does not have preelaborable initialization.
 Similarly the evaluation of an extension_aggregate with an ancestor
-subtype_mark denoting such a subtype."
+subtype_mark denoting a subtype of such a type."
 
 Add a new bullet after C.4(4): "No subtype_mark denotes a controlled type, a
 private type, a private extension, a generic formal private type, a generic
-formal derived type whose ancestor subtype is tagged, or a descendant of such
-a type."
+formal derived type, or a descendant of such a type."
 
 Add the following after RM95 10.2.1(11):
 
-"The following rules specify which entities have preelaborable
-initialization:
+"The following rules specify which entities have preelaborable initialization:
 
 - The partial view of a private type or private extension, a protected type
 without entry_declarations, a generic formal private type, or a generic
-formal derived type whose ancestor subtype is tagged, have preelaborable
-initialization if and only if the pragma Preelaborable_Initialization has
-been applied to them.
-
-- Task types and protected types with entry_declarations do not have
-preelaborable initialization; controlled types which have an overriden
-Initialize do not have preelaborable initialization.
+formal derived type, have preelaborable initialization if and only if the pragma
+Preelaborable_Initialization has been applied to them.
 
-- A view of a type has preelaborable initialization if it is an elementary
-type, an array type whose component subtype has preelaborable initialization,
-a record type whose components all have preelaborable initialization, a
-derived type whose parent type has preelaborable initialization and (in the
-case of a record extension) whose components all have preelaborable
-initialization.
+- Protected types with entry_declarations and task types do not have
+preelaborable initialization.
 
 - A component (including a discriminant) of a record or protected type has
 preelaborable initialization if its declaration includes a default_expression
-whose execution does not perform any of the actions listed in RM95 10.2.1(6-
-9), or if its declaration does not include a default expression and its
-nominal subtype has preelaborable initialization.
+whose execution does not perform any of the actions listed in RM95 10.2.1(6-9),
+or if its declaration does not include a default expression and its type has
+preelaborable initialization.
 
-- A constrained subtype of a record type has preelaborable initialization if
-all its non-discriminant components have preelaborable initialization.
+- A derived type has preelaborable initialization if its parent type has
+preelaborable initialization and (in the case of a derived record or protected
+type) if the non-inherited components all have preelaborable initialization.
+Moreover, a user-defined controlled type with a local override for the
+Initialize procedure does not have preelaborable initialization.
 
-- Other subtypes have preelaborable initialization if their base type has
-preelaborable initialization.
+- A view of a type has preelaborable initialization if it is an elementary
+type, an array type whose component type has preelaborable initialization,
+or a record type whose components all have preelaborable initialization.
 
 A pragma Preelaborable_Initialization specifies that a type has preelaborable
 initialization.  The form of this pragma is as follows:
 
         pragma Preelaborable_Initialization (direct_name);
 
-This pragma must appear (1) in the visible part of a package, or (2) in the
-formal part of a generic library package.
+This pragma must appear in the visible part of a package or generic package.
 
-In the first case, the enclosing library unit shall be the declaration of a
-preelaborated package.  The direct_name shall denote the first subtype of a
+If the pragma appears in the first list of declarative_items of a
+package_specification, then the direct_name shall denote the first subtype of a
 protected type without entry_declarations, private type or private extension
-declared within the same package visible part as the pragma.
-
-In the direct_name denotes a private type or a private extension, the full
-view of the type shall have preelaborable initialization.  If the direct_name
-denotes a protected type, each component of the protected type shall have
-preelaborable initialization.  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.
-
-In the second case, the direct_name shall denote a generic formal private
-type or a generic formal derived type declared in the same generic formal
-part as the pragma.  Moreover, if the direct_name denotes a formal derived
-type, the ancestor subtype shall be a tagged type.  If the pragma
-Preelaborable_Initialization is applied to a formal type, in a
-generic_instantiation the actual type shall have preelaborable
-initialization."
+declared within the same package as the pragma.  If the pragma is applied to a
+protected type, each component of the protected type shall have preelaborable
+initialization.  If the pragma is applied to a private type or a private
+extension, the full view of the type shall have preelaborable initialization.
+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.
+
+If the pragma appears in a generic_formal_part, then the direct_name shall
+denote a generic formal private type or a generic formal derived type declared
+in the same generic_formal_part as the pragma.  In a generic_instantiation the
+corresponding actual type shall have preelaborable initialization."
 
-!discussion 99-03-12
+!discussion
 
 1. A "default-initialized object" is an object for which the implicit
 initialization described in RM95 3.3.1(10-14) takes place.  Examples of
@@ -165,17 +152,17 @@
 declared in the 'narrow' variant.  The same remark applies to the non-generic
 equivalents of the various generic packages.
 
-Ada.Calendar.Time                                                               yes
-Ada.Finalization.Controlled                                             yes
-Ada.Finalization.Limited_Controlled                                     yes
+Ada.Calendar.Time                                               yes
+Ada.Finalization.Controlled                                     yes
+Ada.Finalization.Limited_Controlled                             yes
 Ada.Numerics.Generic_Complex_Types.Imaginary                    yes
-Ada.Streams.Root_Stream_Type                                            yes
+Ada.Streams.Root_Stream_Type                                    yes
 Ada.Strings.Bounded.Generic_Bounded_Length.Bounded_String       no
-Ada.Strings.Maps.Character_Mapping                                      yes
+Ada.Strings.Maps.Character_Mapping                              yes
 Ada.Strings.Maps.Character_Set                                  yes
 Ada.Strings.Unbounded.Unbounded_String                          yes
 Interfaces.C.Strings.Chars_Ptr                                  yes
-System.Address                                                          yes
+System.Address                                                  yes
 System.Storage_Pool.Root_Storage_Pool                           yes
 
 Note: The type Bounded_String cannot have a pragma
@@ -183,9 +170,12 @@
 instantiate Generic_Bounded_Length with a non-static expression for the
 parameter Max.
 
+!ACATS test
 
+A C-Test is needed to test the newly legal cases allowed by this AI. B-Test
+BA21A02 checks for the (still) illegal cases.
 
-!appendix 96-09-10
+!appendix
 
 !section 10.2.1(9)
 !subject Default-initialized objects

Questions? Ask the ACAA Technical Agent