Skip to content

Commit 09a66a7

Browse files
Update testnullpointer.cpp
1 parent c400712 commit 09a66a7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Diff for: test/testnullpointer.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ class TestNullPointer : public TestFixture {
164164
TEST_CASE(nullpointerStdString);
165165
TEST_CASE(nullpointerStdStream);
166166
TEST_CASE(nullpointerSmartPointer);
167+
TEST_CASE(nullpointerArray);
167168
TEST_CASE(functioncall);
168169
TEST_CASE(functioncalllibrary); // use Library to parse function call
169170
TEST_CASE(functioncallDefaultArguments);
@@ -4039,6 +4040,14 @@ class TestNullPointer : public TestFixture {
40394040
ASSERT_EQUALS("[test.cpp:5]: (error) Null pointer dereference: f()\n", errout_str());
40404041
}
40414042

4043+
void nullpointerArray() {
4044+
check("void f() {\n" // #12786
4045+
" const int b[2] = {};\n"
4046+
" if (b) {}\n"
4047+
"}\n");
4048+
ASSERT_EQUALS("", errout_str());
4049+
}
4050+
40424051
void functioncall() { // #3443 - function calls
40434052
// dereference pointer and then check if it's null
40444053
{

0 commit comments

Comments
 (0)