CVS difference for ais/ai-00255.txt

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

--- ais/ai-00255.txt	2001/09/08 03:35:06	1.3
+++ ais/ai-00255.txt	2002/03/13 00:48:28	1.4
@@ -558,3 +558,78 @@
 I've slightly changed the AI to make the change Tucker suggests.
 
 ****************************************************************
+
+!topic Nominal subtype of IN OUT generic formal objects
+!reference RM95-12.4(9), 8.5.1(5)
+!from Adam Beneschan 03-01-02
+!discussion
+
+I believe that the language in 12.4(9) needs clarification.  I had a
+lot of trouble figuring out whether this should be legal:
+
+    type Rec (D : Integer := 1) is record
+       case D is
+          when 1 =>
+             F1 : Integer;
+          when others =>
+             null;
+       end case;
+
+   subtype Rec1 is Rec(1);
+
+   generic
+      Obj1 : in out Rec1;
+   package Genpack is
+      Renames1 : Integer renames Obj1.F1;  -- LEGAL?
+   end Genpack;
+
+According to 8.5.1(5), the legality of the object rename depends on
+whether the nominal subtype of Obj1 is unconstrained.  I tried to look
+up the definition of a nominal subtype for a generic formal object in
+12.4(9).  This paragraph reads:
+
+    A formal_object_declaration declares a generic formal object.  The
+    default mode is in.  For a formal object of mode in, the nominal
+    subtype is the one denoted by the subtype_mark in the declaration
+    of the formal.  For a formal object of mode in out, its type is
+    determined by the subtype_mark in the declaration; its nominal
+    subtype is nonstatic, even if the subtype_mark denotes a static
+    subtype.
+
+This tells me that for a generic formal IN OUT object, the nominal
+subtype of the object is "nonstatic" (a property which does not help
+determine whether the rename is legal), but it doesn't say what the
+nominal subtype *is*.  From looking at the rest of the paragraph, I
+concluded that the nominal subtype was the one denoted by the
+subtype_mark, just as for IN objects, except that it was nonstatic.
+This led me to believe that the renaming was legal, since the nominal
+subtype of Obj1 would then be constrained, and 8.5.1(5) would not
+apply.  However, the ACATS tests b85003a and b85003b contradicted this
+conclusion.
+
+I now have figured out, from 12.4(12), that the constraints on the
+subtype are irrelevant and therefore the nominal subtype of Obj1
+should be the first subtype of the object's type---but this is still
+an assumption, more or less, since the RM doesn't really say that.  My
+suggestion is to add language to 12.4(9) stating that the nominal
+subtype of a generic formal IN OUT object is the first subtype, if
+that is correct.
+
+****************************************************************
+
+From:
+Sent: Friday, March 1, 2002 9:26 PM
+
+So did the ARG. :-) This looks almost exactly like the question in AI-255.
+That AI is ready to be discussed at a meeting, but has been omitted from the
+agenda (probably by mistake).
+
+For future reference, there is a cross reference listing of AIs by paragraph
+number on the web site, get to it from the HTML index:
+   www.ada-auth.org/AI-SUMMARY.HTML
+or directly at:
+   www.ada-auth.org/AI-XREF.HTML
+
+In this case, if you look at either 8.5.1 or 12.4, you'll find AI-255.
+
+****************************************************************

Questions? Ask the ACAA Technical Agent