diff --git a/cfg/std.cfg b/cfg/std.cfg index fa499cf16..9577a6fc3 100644 --- a/cfg/std.cfg +++ b/cfg/std.cfg @@ -8855,7 +8855,6 @@ initializer list (7) string& replace (const_iterator i1, const_iterator i2, init - diff --git a/test/testcondition.cpp b/test/testcondition.cpp index 3fc84e532..436878c18 100644 --- a/test/testcondition.cpp +++ b/test/testcondition.cpp @@ -4895,6 +4895,16 @@ private: " return p != NULL && q != NULL && p == NULL;\n" "}\n"); ASSERT_EQUALS("[test.cpp:2]: (style) Return value 'p==NULL' is always false\n", errout.str()); + + check("struct S {\n" // #11789 + " std::vector v;\n" + " void f(int i) const;\n" + "};\n" + "void S::f(int i) const {\n" + " int j = i - v.size();\n" + " if (j >= 0) {}\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); } void alwaysTrueContainer() {