CVS difference for ais/ai-00404.txt
--- ais/ai-00404.txt 2005/06/16 23:47:40 1.6
+++ ais/ai-00404.txt 2005/08/21 06:00:39 1.7
@@ -1,4 +1,4 @@
-!standard 3.10(6) 05-05-11 AI95-00404/05
+!standard 3.10(6) 05-08-15 AI95-00404/06
!standard 3.9.2(11)
!class amendment 05-01-28
!status Amendment 200Y 05-03-14
@@ -142,8 +142,8 @@
procedure Not_Disp_2(X : not null access T);
end Inner;
- procedure Ren1(X : access T) renames Not_Disp_1; -- illegal
- procedure Ren2(X : access T) renames Not_Disp_2; -- legal
+ procedure Ren1(X : access T) renames Inner.Not_Disp_1; -- illegal
+ procedure Ren2(X : access T) renames Inner.Not_Disp_2; -- legal
procedure Inst1 is new Gen_Subp_1(T); -- illegal
procedure Inst2 is new Gen_Subp_2(T); -- legal
@@ -300,6 +300,55 @@
I agree with your arguments: there doesn't seem to be any good reason to
force access results to be null-excluding.
+
+*************************************************************
+
+!topic Bad example in AI-404
+!reference AI95-00404
+!from Adam Beneschan 05-04-25
+!discussion
+
+
+The example in AI-404 to demonstrate the new rule about dispatching
+operations created by renaming and generic instantiations has a
+problem.
+
+
+ generic
+ type GT is private;
+ procedure Gen_Subp_1(Y : access GT);
+
+ generic
+ type GT is private;
+ procedure Gen_Subp_2(Y : not null access GT);
+
+ with Gen_Subp_1; with Gen_Subp_2;
+ package P is
+ type T is tagged ....
+
+ package Inner is
+ procedure Not_Disp_1(X : access T);
+ procedure Not_Disp_2(X : not null access T);
+ end Inner;
+
+ procedure Ren1(X : access T) renames Not_Disp_1; -- illegal
+ procedure Ren2(X : access T) renames Not_Disp_2; -- legal
+
+ procedure Inst1 is new Gen_Subp_1(T); -- illegal
+ procedure Inst2 is new Gen_Subp_2(T); -- legal
+ end P;
+
+
+Besides the obvious problem that Not_Disp_1 and Not_Disp_2 are not
+visible at the point of the renaming declarations, the more subtle
+problem is that the generic instantiations cannot be legal, because
+the occurrence of the instantiation causes T to be frozen (13.14(11)),
+and thus no new dispatching operations on T could be defined by the
+instantiation, with or without the new rule. (Or have I read the
+rules wrong?)
+
+This is really a minor nitpick, since this example hasn't found its
+way into the Ada 2006 RM.
*************************************************************
Questions? Ask the ACAA Technical Agent