You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/testnullpointer.cpp
+13Lines changed: 13 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -587,6 +587,19 @@ class TestNullPointer : public TestFixture {
587
587
"}");
588
588
TODO_ASSERT_EQUALS("error", "", errout.str());
589
589
590
+
// while
591
+
check("void f(int *p) {\n"
592
+
" *p = 0;\n"
593
+
" while (p) { p = 0; }\n"
594
+
"}");
595
+
ASSERT_EQUALS("", errout.str());
596
+
597
+
check("void f(int *p) {\n"
598
+
" *p = 0;\n"
599
+
" while (p) { }\n"
600
+
"}");
601
+
ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:3]: (warning) Possible null pointer dereference: p - otherwise it is redundant to check it against null.\n", errout.str());
0 commit comments