Permalink
Browse files

Merge pull request #1431 from 9rnsr/fix9263

Issue 9263 - statement is not reachable when statement is reachable
  • Loading branch information...
2 parents b07e161 + 9e58954 commit 539b54ac7c423f53966384bd572ec4db10c6da0e @WalterBright WalterBright committed Jan 3, 2013
Showing with 208 additions and 188 deletions.
  1. +3 −1 src/statement.c
  2. +205 −187 test/runnable/testswitch.d
View
@@ -3321,8 +3321,10 @@ Statement *SwitchStatement::semantic(Scope *sc)
a->reserve(2);
sc->sw->sdefault = new DefaultStatement(loc, s);
- a->push(sc->sw->sdefault);
a->push(body);
+ if (body->blockExit(FALSE) & BEfallthru)
+ a->push(new BreakStatement(0, NULL));
+ a->push(sc->sw->sdefault);
cs = new CompoundStatement(loc, a);
body = cs;
}
Oops, something went wrong.

0 comments on commit 539b54a

Please sign in to comment.