mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-31 12:03:13 +01:00
Fix bug in CaseStatement::semantic when there's no enclosing switch.
This commit is contained in:
@@ -2424,16 +2424,16 @@ Statement *CaseStatement::semantic(Scope *sc)
|
||||
|
||||
//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)
|
||||
|
||||
Reference in New Issue
Block a user