CVS difference for ai05s/ai05-0158-1.txt
--- ai05s/ai05-0158-1.txt 2009/06/08 02:51:34 1.1
+++ ai05s/ai05-0158-1.txt 2009/06/08 03:29:29 1.2
@@ -37,9 +37,9 @@
choice_list ::= choice {'|' choice}
choice ::= simple_expression | range | subtype_mark
-[Editor's comment: This grammer is ambiguous if the expression is used
+[Editor's comment: This grammar is ambiguous if the expression is used
in a discrete_choice_list (that is, in a variant part, case statement,
-or array aggregate. How that is going to be addressed needs to be described.]
+or array aggregate). See the !discussion section.]
Add after 4.5.2(3): (Name Resolution Rules)
@@ -59,6 +59,25 @@
what we want? We ought to reword this to fit in with the existing wording.]
!discussion
+
+The new syntax introduces an ambiguity in case statements whose expression is
+boolean:
+
+ X : Boolean := ..
+ case X is
+ when Y in 1..10 | 20 => -- ambiguous:
+ -- could be (Y in 1..10) | 20
+ -- which is otherwise type-incorrect
+
+The ambiguity only arises if the case expression is boolean and if the
+left operand and expressions are all static, which seems extremely rare.
+The simplest is to state that a membership operation with multiple expressions
+that appears in a case alternative must be parenthesized.
+
+[Editor's comment: The same surely is true of variant parts, and is *almost*
+true of array aggregates (there is no requirement for staticness there).
+Also note that you can write legal such expressions, but they would only
+happen in ACATS tests: when X in True | False => (!)]
!example
Questions? Ask the ACAA Technical Agent