parent
0f0d042ee2
commit
405e17985a
|
@ -129,6 +129,7 @@ private:
|
|||
TEST_CASE(checkAssignmentInCondition);
|
||||
TEST_CASE(compareOutOfTypeRange);
|
||||
TEST_CASE(knownConditionCast); // #9976
|
||||
TEST_CASE(knownConditionIncrementLoop); // #9808
|
||||
}
|
||||
|
||||
void check(const char code[], Settings *settings, const char* filename = "test.cpp") {
|
||||
|
@ -4380,6 +4381,16 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void knownConditionIncrementLoop() { // #9808
|
||||
check("void f() {\n"
|
||||
" int a = 0;\n"
|
||||
" while (++a < 5) {}\n"
|
||||
" if (a == 1) {}\n"
|
||||
" std::cout << a;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
};
|
||||
|
||||
REGISTER_TEST(TestCondition)
|
||||
|
|
Loading…
Reference in New Issue