CaseStatement specification issue

Sergey Kozyr via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 15 12:46:07 PDT 2014


> It's a fall trough but it is not the reason why it does works. 
> It does because (as Daniel already mentioned) a case is a valid 
> statement, therefore a case following other case is a totally 
> valid statement.
>
> for example:
>
> case 1:
> case 2:
>   return true;
>
> There are three statements. One which must be followed by 
> another (case keyword) and another by an expression (return 
> keyword).


I agree that this is a valid D language construction. But 
documentation says that statement "case 1:" must be followed by 
any statement except other "case" or "default".
Let's open doc http://dlang.org/statement#CaseStatement
You see that "case ArgumentList :" is followed by 
"ScopeStatementList" 
(http://dlang.org/statement#ScopeStatementList) which is a list 
of any statements except CaseStatement or CaseRangeStatement or 
DefaultStatement. This rule conflicts with actual D language 
compiler.


More information about the Digitalmars-d mailing list