Skip to content

Commit

Permalink
Merge pull request #5866 from mathias-lang-sociomantic/fix-14411
Browse files Browse the repository at this point in the history
Fix issue 14411 - Make implicit switch case fallthrough an error
  • Loading branch information
andralex committed Jun 14, 2016
2 parents 4a7dbcd + b76b0ce commit 6e2bf76
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/statement.d
Expand Up @@ -298,7 +298,7 @@ extern (C++) abstract class Statement : RootObject
{
//printf("result = x%x\n", result);
//printf("s: %s\n", s->toChars());
if (global.params.warnings && result & BEfallthru && slast)
if (result & BEfallthru && slast)
{
slast = slast.last();
if (slast && (slast.isCaseStatement() || slast.isDefaultStatement()) && (s.isCaseStatement() || s.isDefaultStatement()))
Expand All @@ -315,7 +315,7 @@ extern (C++) abstract class Statement : RootObject
else
{
const(char)* gototype = s.isCaseStatement() ? "case" : "default";
s.warning("switch case fallthrough - use 'goto %s;' if intended", gototype);
s.error("switch case fallthrough - use 'goto %s;' if intended", gototype);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/fail_compilation/fail11653.d
@@ -1,8 +1,8 @@
// REQUIRED_ARGS: -w
// REQUIRED_ARGS:
/*
TEST_OUTPUT:
---
fail_compilation/fail11653.d(18): Warning: switch case fallthrough - use 'goto case;' if intended
fail_compilation/fail11653.d(18): Error: switch case fallthrough - use 'goto case;' if intended
---
*/

Expand Down

0 comments on commit 6e2bf76

Please sign in to comment.