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

Differences between 1.12 and version 1.13
Log of other versions for file ai05s/ai05-0147-1.txt

--- ai05s/ai05-0147-1.txt	2010/02/23 07:31:06	1.12
+++ ai05s/ai05-0147-1.txt	2010/02/25 05:01:43	1.13
@@ -8207,3 +8207,92 @@
 may appear without its parentheses.
 
 ****************************************************************
+
+From: Bob Duff
+Sent: Tuesday, February 23, 2010  7:45 PM
+
+[Randy Brukardt wrote in another thread:]
+
+> Aside: We didn't try to identify the type of a conditional expression,
+> much less the subtype. So what is the completeness rule for a case statement?
+> Consider:
+>
+>     case (if Func then 1 else 2) is
+>        when 1 => null;
+>        when 2 => null;
+>     end case;
+>
+> Is an others required or not?? Same applies to a case_expression.
+> (Darn, I'm thinking like Steve now.)
+
+As well you should.  ;-)
+
+You might as well have said "then 1 else 1234".
+
+A cond_exp or case_exp should get its type from context.  More formally, it has
+no expected type, or equivalently, it's expected type is "any type". Like a
+type_conv such as T(X), X has no expected type to resolve it.
+
+Above example is ambiguous, and therefore illegal.
+
+****************************************************************
+
+From: Randy Brukardt
+Sent: Wednesday, February 24, 2010  3:14 PM
+
+That's not quite the resolution rule that we use. But in any case, that's not
+the question that I wanted to ask; I think resolution is fine. Let me try again:
+
+    subtype Short_Natural is Integer range 1 .. 5;
+    subtype Short_Positive is Integer range 0 .. 5;
+    A : Short_Natural;
+    B : Short_Positive;
+
+    case (if Func then A else B) is
+       when 1..5 => null;
+       when 0 => null; -- Legal?
+    end case; -- Whole statement legal?
+
+Is the subtype used for completeness checking here Short_Natural,
+Short_Positive, or Integer??
+
+I think we're OK here because this isn't a "Name" (and making it one would
+provide a subtype explicitly). So 5.4(9) applies, and the statement is not legal
+(it needs to cover the range of Integer).
+
+Are there any other places where the subtype of an expression affects legality?
+
+****************************************************************
+
+From: Bob Duff
+Sent: Wednesday, February 24, 2010  3:37 PM
+
+> Is the subtype used for completeness checking here Short_Natural,
+> Short_Positive, or Integer??
+
+Integer, I guess.
+
+> I think we're OK here because this isn't a "Name" (and making it one
+> would provide a subtype explicitly).
+
+It would be cool if you could say:
+
+    (if Func then A else B) := 123;
+
+But I don't dare ask for that!  ;-)
+
+>...So 5.4(9) applies, and the statement is not  legal (it needs to
+>cover the range of Integer).
+
+Agreed.
+
+> Are there any other places where the subtype of an expression affects
+> legality?
+
+Case expressions.  ;-)
+
+The rules refer to case statements, so we're OK there.
+
+Can't think of any others off the top of my head.
+
+****************************************************************

Questions? Ask the ACAA Technical Agent