Mercurial > projects > ldc
changeset 1164:166042b48c28
Fix bug in CaseStatement::semantic when there's no enclosing switch.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sat, 28 Mar 2009 21:10:53 +0100 |
parents | ea52660f828b |
children | 226c07c71967 ab186e535e72 |
files | dmd/statement.c |
diffstat | 1 files changed, 7 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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)