Added unit test for #3392

This commit is contained in:
PKEuS 2014-09-02 12:03:05 +02:00
parent a52401cf1b
commit 4e9b145727
1 changed files with 6 additions and 0 deletions

View File

@ -1727,6 +1727,12 @@ private:
" return p && p->x;\n"
"}");
ASSERT_EQUALS("", errout.str());
check("void f(int x, int *p) {\n"
" if (x || !p) {}\n"
" *p = 0;\n"
"}");
ASSERT_EQUALS("[test.cpp:3] -> [test.cpp:2]: (warning) Possible null pointer dereference: p - otherwise it is redundant to check it against null.\n", errout.str());
}
// Test CheckNullPointer::nullConstantDereference