File tree 1 file changed +9
-0
lines changed
1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -164,6 +164,7 @@ class TestNullPointer : public TestFixture {
164
164
TEST_CASE (nullpointerStdString);
165
165
TEST_CASE (nullpointerStdStream);
166
166
TEST_CASE (nullpointerSmartPointer);
167
+ TEST_CASE (nullpointerArray);
167
168
TEST_CASE (functioncall);
168
169
TEST_CASE (functioncalllibrary); // use Library to parse function call
169
170
TEST_CASE (functioncallDefaultArguments);
@@ -4039,6 +4040,14 @@ class TestNullPointer : public TestFixture {
4039
4040
ASSERT_EQUALS (" [test.cpp:5]: (error) Null pointer dereference: f()\n " , errout_str ());
4040
4041
}
4041
4042
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
+
4042
4051
void functioncall () { // #3443 - function calls
4043
4052
// dereference pointer and then check if it's null
4044
4053
{
You can’t perform that action at this time.
0 commit comments