We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c3af708 commit f09b413Copy full SHA for f09b413
test/testcondition.cpp
@@ -4031,6 +4031,15 @@ class TestCondition : public TestFixture {
4031
"}");
4032
ASSERT_EQUALS("[test.cpp:3]: (style) Condition 'x==-5' is always false\n", errout.str());
4033
4034
+ // #8407
4035
+ check("int f(void) {\n"
4036
+ " for(int i = 0; i <1; ++i)\n"
4037
+ " if(i == 0) return 1; \n" // <<
4038
+ " else return 0;\n"
4039
+ " return -1;\n"
4040
+ "}");
4041
+ ASSERT_EQUALS("[test.cpp:3]: (style) Condition 'i==0' is always true\n", errout.str());
4042
+
4043
check("void f(unsigned int u1, unsigned int u2) {\n"
4044
" if (u1 <= 10 && u2 >= 20) {\n"
4045
" if (u1 != u2) {}\n"
0 commit comments