Skip to content

Commit 09c92f0

Browse files
Update testnullpointer.cpp
1 parent 0bf9b25 commit 09c92f0

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

test/testnullpointer.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3944,6 +3944,15 @@ class TestNullPointer : public TestFixture {
39443944
"void f() { std::string s = g(0L); }\n");
39453945
ASSERT_EQUALS("[test.cpp:2:29]: (error) Null pointer dereference: g(0L) [nullPointer]\n",
39463946
errout_str());
3947+
3948+
check("const char* g() { return nullptr; }\n" // #14098
3949+
"std::string f() {\n"
3950+
" std::string s{ g() };\n"
3951+
" return s + std::string(g());\n"
3952+
"}\n");
3953+
ASSERT_EQUALS("[test.cpp:3:21]: (error) Null pointer dereference: g() [nullPointer]\n"
3954+
"[test.cpp:4:29]: (error) Null pointer dereference: g() [nullPointer]\n",
3955+
errout_str());
39473956
}
39483957

39493958
void nullpointerStdStream() {

0 commit comments

Comments
 (0)