# HG changeset patch # User Christian Kamm # Date 1238271053 -3600 # Node ID 166042b48c28a0d0eb7ed40aff36d25db11a4d03 # Parent ea52660f828b9fdf230c58caae54428d107ba51d Fix bug in CaseStatement::semantic when there's no enclosing switch. diff -r ea52660f828b -r 166042b48c28 dmd/statement.c --- a/dmd/statement.c Sat Mar 28 20:45:33 2009 +0100 +++ b/dmd/statement.c Sat Mar 28 21:10:53 2009 +0100 @@ -2424,16 +2424,16 @@ //printf("CaseStatement::semantic() %s\n", toChars()); - // LDC - enclosingScopeExit = sc->enclosingScopeExit; - if (enclosingScopeExit != sw->enclosingScopeExit) - { - error("case must be inside the same try, synchronized or volatile level as switch"); - } - exp = exp->semantic(sc); if (sw) { + // LDC + enclosingScopeExit = sc->enclosingScopeExit; + if (enclosingScopeExit != sw->enclosingScopeExit) + { + error("case must be inside the same try, synchronized or volatile level as switch"); + } + exp = exp->implicitCastTo(sc, sw->condition->type); exp = exp->optimize(WANTvalue | WANTinterpret); if (exp->op != TOKstring && exp->op != TOKint64)