Skip to content

Commit 9295246

Browse files
Update testnullpointer.cpp
1 parent d784e85 commit 9295246

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

test/testnullpointer.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3787,6 +3787,21 @@ class TestNullPointer : public TestFixture {
37873787
" g(x);\n"
37883788
"}");
37893789
ASSERT_EQUALS("", errout_str());
3790+
3791+
check("struct T {\n" // #14477
3792+
" bool b{};\n"
3793+
" T* next{};\n"
3794+
"};\n"
3795+
"bool g(const T*& r) {\n"
3796+
" const T* t = r;\n"
3797+
" r = t->next;\n"
3798+
" return t->b;\n"
3799+
"}\n"
3800+
"void f(const T* tok) {\n"
3801+
" if (g(tok)) {}\n"
3802+
" if (tok) {}\n"
3803+
"}\n");
3804+
ASSERT_EQUALS("", errout_str());
37903805
}
37913806

37923807
void nullpointerExit() {

0 commit comments

Comments
 (0)