File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -145,6 +145,7 @@ class TestNullPointer : public TestFixture {
145145 TEST_CASE (nullpointer105); // #13861
146146 TEST_CASE (nullpointer106); // #13682
147147 TEST_CASE (nullpointer107); // #13682 (FP/FN cases around guards that depend on the pointer indirectly)
148+ TEST_CASE (nullpointer108);
148149 TEST_CASE (nullpointer_addressOf); // address of
149150 TEST_CASE (nullpointerSwitch); // #2626
150151 TEST_CASE (nullpointer_cast); // #4692
@@ -3105,6 +3106,15 @@ class TestNullPointer : public TestFixture {
31053106 ASSERT_EQUALS (" " , errout_str ());
31063107 }
31073108
3109+ void nullpointer108 () { // #14422
3110+ check (" void f() {\n "
3111+ " int *p{};\n "
3112+ " int *&r{p};\n "
3113+ " if (*r) {}\n "
3114+ " }" );
3115+ ASSERT_EQUALS (" [test.cpp:4:10]: (error) Null pointer dereference: r [nullPointer]\n " , errout_str ());
3116+ }
3117+
31083118 void nullpointer_addressOf () { // address of
31093119 check (" void f() {\n "
31103120 " struct X *x = 0;\n "
You can’t perform that action at this time.
0 commit comments