Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/forwardanalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ struct ForwardTraversal {
return Break();
if (stepTok && updateRecursive(stepTok) == Progress::Break)
return Break();
if (condTok && updateRecursive(condTok) == Progress::Break)
if (condTok && !Token::simpleMatch(condTok, ":") && updateRecursive(condTok) == Progress::Break)
return Break();
return Progress::Continue;
}
Expand Down
13 changes: 13 additions & 0 deletions test/testother.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ class TestOther : public TestFixture {
TEST_CASE(moveClassVariable);
TEST_CASE(forwardAndUsed);
TEST_CASE(moveAndReference);
TEST_CASE(moveForRange);

TEST_CASE(funcArgNamesDifferent);
TEST_CASE(funcArgOrderDifferent);
Expand Down Expand Up @@ -10300,6 +10301,18 @@ class TestOther : public TestFixture {
ASSERT_EQUALS("[test.cpp:7]: (warning) Access of moved variable 'r'.\n", errout.str());
}

void moveForRange()
{
check("struct C {\n"
" void f() {\n"
" for (auto r : mCategory.find(std::move(mWhere))) {}\n"
" }\n"
" cif::category mCategory;\n"
" cif::condition mWhere;\n"
"};\n");
ASSERT_EQUALS("", errout.str());
}

void funcArgNamesDifferent() {
check("void func1(int a, int b, int c);\n"
"void func1(int a, int b, int c) { }\n"
Expand Down