CVS difference for ais/ai-00229.txt

Differences between 1.2 and version 1.3
Log of other versions for file ais/ai-00229.txt

--- ais/ai-00229.txt	2000/12/07 04:35:35	1.2
+++ ais/ai-00229.txt	2001/05/11 03:46:21	1.3
@@ -1,5 +1,6 @@
-!standard  3.10.2   (32)                             00-04-10  AI95-00229/00
+!standard  3.10.2   (32)                             01-05-04  AI95-00229/01
 !class binding interpretation 00-04-10
+!status work item 01-05-04
 !status received 00-04-10
 !priority Medium
 !difficulty Medium
@@ -8,6 +9,10 @@
 
 !summary
 
+The expression P'Access (where P denotes a subprogram declared in a generic
+specification) is illegal within a generic body if the expected access type is
+not declared within the generic unit.
+
 !question
 
 The following piece of code seems to show a case where the accessibility rules
@@ -33,7 +38,7 @@
             X := X + 1;
         end Foo;
     begin
-        P := Foo'Access; -- Legal? (Hope not.)
+        P := Foo'Access; -- Legal? (No.)
     end G;
 
     procedure Bar is
@@ -49,14 +54,60 @@
 
 !recommendation
 
+See wording.
+
 !wording
 
+Add after the last sentence of RM95 3.10.2(32):
+
+If the subprogram denoted by P is declared within a generic specification, and
+the expression P'Access occurs within the body of that generic, then S shall be
+declared within the generic unit.
+
 !discussion
 
-!corrigendum xx.xx.xx(0x)
+Evidently we want to disallow the above construct, because dangling references
+are a very serious safety issue.  However, there is a compatibility issue here,
+because there may be code out there that uses access-to-subprogram types in
+conjunction with generics, and whatever solution we come up with could possible
+make existing code invalid (even if that code doesn't actually create dangling
+references).
+
+The proposed modification fixes the above dangling reference problem without
+unnecessarily impacting existing code.
+
+!corrigendum 03.10.02(32)
+
+@drepl
+@xindent<P'Access yields an access value that designates the subprogram
+denoted by P. The type of P'Access is an access-to-subprogram
+type (@i<S>), as determined by the expected type. The accessibility
+level of P shall not be statically deeper than that of @i<S>. In
+addition to the places where Legality Rules normally apply (see
+12.3), this rule applies also in the private part of an instance
+of a generic unit. The profile of P shall be subtype-conformant
+with the designated profile of @i<S>, and shall not be Intrinsic. If
+the subprogram denoted by P is declared within a generic body, S
+shall be declared within the generic body.>
+@dby
+@xindent<P'Access yields an access value that designates the subprogram
+denoted by P. The type of P'Access is an access-to-subprogram
+type (@i<S>), as determined by the expected type. The accessibility
+level of P shall not be statically deeper than that of @i<S>. In
+addition to the places where Legality Rules normally apply (see
+12.3), this rule applies also in the private part of an instance
+of a generic unit. The profile of P shall be subtype-conformant
+with the designated profile of @i<S>, and shall not be Intrinsic. If
+the subprogram denoted by P is declared within a generic body, S
+shall be declared within the generic body. If the subprogram denoted by P
+is declared within a generic specification, and the expression P'Access
+occurs within the body of that generic, then @i<S> shall be declared within
+the generic unit.>
 
 !ACATS test
 
+A B-Test is needed for this issue.
+
 !appendix
 
 From: Pascal Leroy
@@ -142,13 +193,3 @@
 precisely in order to handle interactions with child units of generics.
 
 *************************************************************
-
-
-*************************************************************
-
-
-*************************************************************
-
-
-*************************************************************
-

Questions? Ask the ACAA Technical Agent