Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions test/testnullpointer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ class TestNullPointer : public TestFixture {
TEST_CASE(nullpointer99); // #10602
TEST_CASE(nullpointer100); // #11636
TEST_CASE(nullpointer101); // #11382
TEST_CASE(nullpointer102);
TEST_CASE(nullpointer_addressOf); // address of
TEST_CASE(nullpointerSwitch); // #2626
TEST_CASE(nullpointer_cast); // #4692
Expand Down Expand Up @@ -2843,6 +2844,20 @@ class TestNullPointer : public TestFixture {
ASSERT_EQUALS("", errout.str());
}

void nullpointer102()
{
check("struct S { std::string str; };\n" // #11534
"struct T { S s; };\n"
"struct U { T t[1]; };\n"
"void f(const T& t, const U& u, std::string& str) {\n"
" if (str.empty())\n"
" str = t.s.str;\n"
" else\n"
" str = u.t[0].s.str;\n"
"}\n");
ASSERT_EQUALS("", errout.str());
}

void nullpointer_addressOf() { // address of
check("void f() {\n"
" struct X *x = 0;\n"
Expand Down