File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed
Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -903,6 +903,8 @@ void CheckOther::checkUnreachableCode()
903903 }
904904 while (Token::simpleMatch (secondBreak, " }" ) && secondBreak->scope ()->type == Scope::ScopeType::eUnconditional)
905905 secondBreak = secondBreak->next ();
906+ if (Token::simpleMatch (secondBreak, " ;" ))
907+ continue ;
906908
907909 // Statements follow directly, no line between them. (#3383)
908910 // TODO: Try to find a better way to avoid false positives due to preprocessor configurations.
Original file line number Diff line number Diff line change @@ -5644,6 +5644,11 @@ class TestOther : public TestFixture {
56445644 " } while (i < 10);\n "
56455645 " }\n " );
56465646 ASSERT_EQUALS (" [test.cpp:5]: (style) 'continue' is redundant since it is the last statement in a loop.\n " , errout_str ());
5647+
5648+ check (" int f() {\n " // #13475
5649+ " { return 0; };\n "
5650+ " }\n " );
5651+ ASSERT_EQUALS (" " , errout_str ());
56475652 }
56485653
56495654
You can’t perform that action at this time.
0 commit comments