1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Bug 352983 - internal error in switch isFallThroughStatement

This commit is contained in:
Marc-Andre Laperle 2011-07-25 13:49:00 -04:00
parent 579f5aa0ec
commit 74ecb38ea3
2 changed files with 17 additions and 2 deletions

View file

@ -139,7 +139,11 @@ public class CaseBreakChecker extends AbstractIndexAstChecker implements IChecke
if (body == null) return true;
if (body instanceof IASTCompoundStatement) {
IASTStatement[] statements = ((IASTCompoundStatement) body).getStatements();
return isFallThroughStamement(statements[statements.length - 1]);
if (statements.length > 0) {
return isFallThroughStamement(statements[statements.length - 1]);
}
return true;
} else if (isBreakOrExitStatement(body)) {
return false;
} else if (body instanceof IASTExpressionStatement) {

View file

@ -558,5 +558,16 @@ public class CaseBreakCheckerTest extends CheckerTestCase {
checkNoErrors();
}
//void foo()
//{
//switch(0)
//default:
//{
//}
//}
public void testEmptyCompoundStatement() {
String code = getAboveComment();
loadCodeAndRun(code);
checkErrorLine(4);
}
}