Skip to content

Commit 7fd2f59

Browse files
Update testnullpointer.cpp
1 parent c921508 commit 7fd2f59

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

test/testnullpointer.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -995,6 +995,14 @@ class TestNullPointer : public TestFixture {
995995
"char f(S* s) { return s->p ? 'a' : s->p->c; }\n");
996996
ASSERT_EQUALS("[test.cpp:2:24] -> [test.cpp:2:37]: (warning) Either the condition 's->p' is redundant or there is possible null pointer dereference: s->p. [nullPointerRedundantCheck]\n",
997997
errout_str());
998+
999+
check("int f(const int a[]) {\n" // #14544
1000+
" int i = 0;\n"
1001+
" if (!a)\n"
1002+
" a = &i;\n"
1003+
" return *a;\n"
1004+
"}\n");
1005+
ASSERT_EQUALS("", errout_str());
9981006
}
9991007

10001008
void nullpointer5() {

0 commit comments

Comments
 (0)