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

Differences between 1.16 and version 1.17
Log of other versions for file ai05s/ai05-0188-1.txt

--- ai05s/ai05-0188-1.txt	2011/02/16 04:25:41	1.16
+++ ai05s/ai05-0188-1.txt	2011/03/03 07:13:42	1.17
@@ -1,4 +1,5 @@
-!standard 3.10.2(9/2)                                11-02-11  AI05-0188-1/10
+!standard 3.8.1(15)                                  11-02-18  AI05-0188-1/11
+!standard 3.10.2(9/2)
 !standard 3.10.2(32/2)
 !standard 4.5.7(0)
 !standard 4.9(12)
@@ -15,6 +16,7 @@
 !standard 6.5(5.5/2)
 !class amendment 09-11-03
 !status Amendment 2012 10-07-26
+!status work item 11-02-18
 !status ARG Approved  10-0-0  10-10-30
 !status work item 09-11-03
 !status received 09-11-03
@@ -97,6 +99,39 @@
 
 !wording
 
+Modify 3.8.1(15):
+
+   If the discriminant is of a static constrained scalar subtype {and the
+   discriminated type is not declared in an instance of a generic unit},
+   then each non-others discrete_choice shall cover only values in that
+   subtype, and each value of that subtype shall be covered by some
+   discrete_choice [(either explicitly or by others)];
+
+Immediately following, append the following AARM note:
+
+   AARM note:
+   The exemption for a discriminated type declared in an instance
+   allows the following example:
+
+     declare
+       generic
+         type T is new Integer;
+       package G is
+         type Rec (Discrim : T) is record
+            case Discrim is
+               when -10 .. -1 =>
+                  Foo : Float;
+               when others =>
+                  null;
+            end case;
+         end record;
+       end G;
+
+       package I is new G (Natural); -- legal
+     begin
+       null;
+     end;
+
 Add immediately after 3.10.2(9/2), as a separate bulleted item:
 
    The accessibility level of a conditional_expression is the
@@ -214,7 +249,26 @@
 *dependent_*expressions of the if_expression shall be of a boolean type.
 
 All Legality Rules that apply to the discrete_choices of a case_statement (see 5.4),
-apply to the discrete_choices of a case_expression.
+apply to the discrete_choices of a case_expression {which does not occur within
+an instance of a generic unit}.
+
+   AARM note:
+   The exemption for a case expression which occurs in an instance
+   allows the following example:
+
+       generic
+         with function Int_Func return Integer;
+       package G is
+         X : Float := (case Int_Func is
+                         when Integer'First .. -1 => -1.0,
+                         when 0 => 0.0,
+                         when Positive => 1.0);
+       end G;
+
+       function Nat_Func return Natural is (123);
+ 
+       package I is new G (Int_Func => Nat_Func); -- Legal
+ 
 
     Dynamic Semantics
 
@@ -323,6 +377,21 @@
 
 ACATS B and C tests are needed.
 
+!corrigendum 3.8.1(15)
+
+@drepl
+@xbullet<If the discriminant is of a static constrained scalar subtype, then each
+non-@b<others> @fa<discrete_choice> shall cover only values in that subtype, and
+each value of that subtype shall be covered by some @fa<discrete_choice> (either
+explicitly or by others);>
+@dby
+@xbullet<If the discriminant is of a static constrained scalar subtype and the
+discriminated type is not declared in an instance of a generic unit, then each
+non-@b<others> @fa<discrete_choice> shall cover only values in that subtype, and
+each value of that subtype shall be covered by some @fa<discrete_choice> (either
+explicitly or by others);>
+
+
 !corrigendum 3.10.2(9/2)
 
 @dinsa
@@ -2205,5 +2274,79 @@
 implemented (especially as no bug can result from omitting it). That seems like
 the best reason for actually making an explicit exception in this case: the
 recheck will take a lot of work to implement.
+
+****************************************************************
+
+From: Steve Baird
+Sent: Friday, February 18, 2011  2:34 PM
+
+Here is proposed wording for this issue, consistent with the intent agreed upon
+earlier today in Tampa.
+
+=====
+
+Modify 3.8.1/15
+
+   If the discriminant is of a static constrained scalar subtype {and the
+   discriminated type is not declared in an instance of a generic unit},
+   then each non-others discrete_choice shall cover only values in that
+   subtype, and each value of that subtype shall be covered by some
+   discrete_choice [(either explicitly or by others)];
+
+Immediately following, append the following AARM note:
+
+   AARM note:
+   The exemption for a discriminated type declared in an instance
+   allows the following example:
+
+     declare
+       generic
+         type T is new Integer;
+       package G is
+         type Rec (Discrim : T) is record
+            case Discrim is
+               when -10 .. -1 =>
+                  Foo : Float;
+               when others =>
+                  null;
+            end case;
+         end record;
+       end G;
+
+       package I is new G (Natural); -- legal
+     begin
+       null;
+     end;
+
+====
+
+Modify the existing wording for case expressions,
+
+   All Legality Rules that apply to the discrete_choices of a
+   case_statement (see 5.4), apply to the discrete_choices of a
+   case_expression {which does not occur within an instance of
+   a generic unit}.
+
+Immediately following, append the following AARM note:
+
+   AARM note:
+   The exemption for a case expression which occurs in an instance
+   allows the following example:
+
+     declare
+       generic
+         with function Int_Func return Integer;
+       package G is
+         X : Float := (case Int_Func is
+                         when Integer'First .. -1 => -1.0,
+                         when 0 => 0.0,
+                         when Positive => 1.0);
+       end G;
+       function Nat_Func return Natural is
+         begin return 123; end Nat_Func;
+       package I is new G (Int_Func => Nat_Func); -- legal
+     begin
+       null;
+     end;
 
 ****************************************************************

Questions? Ask the ACAA Technical Agent