On 17/02/2013 16:10, deadalnix wrote:
I have several instance of cases like this :

switch(c) {
     case 'U', 'u' :
     case 'L', 'l' :
         // code . . .
}

dmd from master complains about it (Error: switch case fallthrough - use 'goto 
case;' if
intended). It used to work.
<snip>

Implicit fall through shouldn't have been allowed from the beginning. It would appear that this has finally been banned.

However, according to the grammar, this is now illegal for a different reason:

http://dlang.org/statement.html#SwitchStatement

CaseStatement:
    case ArgumentList : ScopeStatementList

ScopeStatementList:
    StatementListNoCaseNoDefault

StatementListNoCaseNoDefault:
    StatementNoCaseNoDefault
    StatementNoCaseNoDefault StatementListNoCaseNoDefault

But it does seem odd to people coming from C(++), since it doesn't seem aimed at either simplifying the grammar or shielding the programmer's foot against self-inflicted gunfire.

But it does address this issue, which I actually hadn't taken in had been 
resolved
http://d.puremagic.com/issues/show_bug.cgi?id=603

If we want to still allow the old C syntax for multiple cases, then we can 
define

CaseStatement:
    case ArgumentList : ScopeStatementList
    case ArgumentList : CaseStatement

which is only a small change....

Stewart.

Reply via email to