CVS difference for ai05s/ai05-0017-1.txt

Differences between 1.2 and version 1.3
Log of other versions for file ai05s/ai05-0017-1.txt

--- ai05s/ai05-0017-1.txt	2007/04/05 01:49:14	1.2
+++ ai05s/ai05-0017-1.txt	2007/07/26 02:58:05	1.3
@@ -1,5 +1,6 @@
-!standard 13.14(3/1)                                   07-04-04    AI05-0017-1/02
+!standard 13.14(3/1)                                   07-06-17    AI05-0017-1/03
 !class binding interpretation 06-11-09
+!status ARG Approved  7-0-3  07-06-03
 !status work item 06-11-09
 !status received 06-08-02
 !priority High
@@ -52,16 +53,32 @@
 
 The end of a declarative_part, protected_body, or a declaration of a library package
 or generic library package, causes freezing of each entity declared within it, except
-for incomplete types. {The end of a package_body, or a package_body_stub, cause freezing
-of the incomplete types declared within it.} A noninstance body other than a
+for incomplete types. A noninstance body other than a
 renames-as-body causes freezing of each entity declared before it within the
 same declarative_part {that is not an incomplete type; it only causes freezing
 of an incomplete type if the body is within the immediate scope of the incomplete
-type, or if the full_type_declaration and the incomplete_type_declaration occur
-in the same list of declarations.}
+type.}
 
 !discussion
 
+We do need to have freezing of incomplete types, because that helps to prevent
+premature uses in calls. Consider the following:
+
+	package Stt is 
+	    type T is tagged; 
+	    function F return access T'Class; 
+	    function G (X : access T) return Integer; 
+	    I : Integer := G (F); 
+	    type T is tagged null record; 
+	end Stt;
+
+The call to G is dispatching, so we better know the location of the tag
+for type T. The profile of G is frozen, which freezes the anonymous access
+type and its designated type, which is T, which is not completed yet, and that
+violates 13.14(17) (or 3.11.1(8) if you prefer) and an error will occur.
+If we didn't freeze incomplete types, this error would not be detected and we'd
+have a problem.
+
 We don't want an intervening body to freeze any deferred incomplete types, otherwise
 they'd be useless. Moreover, there is no need to freeze them -- their representation is
 not needed until their own body is encountered, because there are numerous restrictions
@@ -82,9 +99,18 @@
 of P1 doesn't freeze P1.T1, otherwise it would be impossible to write a
 Taft Amendment type.
 
-Now that the beginning of the body of P1 doesn't freeze T1, we must at a minimum ensure
-that the *end* of this body freezes T1. This ensures that T1 gets frozen at some
-point, and it preserves the equivalence between proper bodies and stubs.
+Note that the start of the package body P1 does not cause freezing of T1, but the
+end of the declarative part of the package body will freeze everything including T1.
+That happens because the body P1 must necessarily include a completion for T1, which
+will be frozen at the end, and that freezing will also freeze the incomplete view
+(remember that types are frozen, not views). If there is no completion, P1 is illegal
+anyway, so we don't care that the incomplete T1 never gets frozen in that case.
+
+Note that new rules don't have issues with premature uses in calls, as a Taft-Amendment
+type cannot be used in a primitive subprogram for the type [3.10.1(9.3/2)]
+(meaning that there cannot be primitive subprograms for a T-A type [of course,
+the full type can have primitive subprograms]). Since there are no subprograms, there
+aren't any calls to worry about.
 
 !corrigendum 13.14(3/1)
 
@@ -97,14 +123,11 @@
 @dby
 The end of a @fa<declarative_part>, @fa<protected_body>, or a declaration of a
 library package or generic library package, causes freezing of each entity
-declared within it, except for incomplete types. The end of a @fa<package_body>,
-or a @fa<package_body_stub>, cause freezing of the incomplete types declared
-within it. A noninstance body other than
-a renames-as-body causes freezing of each entity declared before it within
+declared within it, except for incomplete types. A noninstance body
+other than a renames-as-body causes freezing of each entity declared before it within
 the same @fa<declarative_part> that is not an incomplete type; it only causes
 freezing of an incomplete type if the body is within the immediate scope of the
-incomplete type, or if the @fa<full_type_declaration> and the
-@fa<incomplete_type_declaration> occur in the same list of declarations.
+incomplete type.
 
 !ACATS test
 

Questions? Ask the ACAA Technical Agent