Skip to content

Commit

Permalink
Merge pull request #6206 from MartinNowak/fix16625
Browse files Browse the repository at this point in the history
fix Issue 16625 - undeprecated switch fallthrough error
  • Loading branch information
dnadlinger committed Oct 23, 2016
2 parents dea09f5 + 90391a7 commit 2ef2272
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/statement.d
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ extern (C++) abstract class Statement : RootObject
else
{
const(char)* gototype = s.isCaseStatement() ? "case" : "default";
s.error("switch case fallthrough - use 'goto %s;' if intended", gototype);
s.deprecation("switch case fallthrough - use 'goto %s;' if intended", gototype);
}
}
}
Expand Down
9 changes: 6 additions & 3 deletions test/fail_compilation/fail11653.d
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// REQUIRED_ARGS:
// REQUIRED_ARGS: -de
/*
TEST_OUTPUT:
---
fail_compilation/fail11653.d(18): Error: switch case fallthrough - use 'goto case;' if intended
fail_compilation/fail11653.d(19): Deprecation: switch case fallthrough - use 'goto case;' if intended
fail_compilation/fail11653.d(24): Deprecation: switch case fallthrough - use 'goto default;' if intended
---
*/

Expand All @@ -18,7 +19,9 @@ void main()
case 2: .. case 3:
output = 2;
break;
default:
case 4:
output = 3;
default:
output = 4;
}
}

0 comments on commit 2ef2272

Please sign in to comment.