File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -140,6 +140,7 @@ class TestNullPointer : public TestFixture {
140140 TEST_CASE (nullpointer99); // #10602
141141 TEST_CASE (nullpointer100); // #11636
142142 TEST_CASE (nullpointer101); // #11382
143+ TEST_CASE (nullpointer102);
143144 TEST_CASE (nullpointer_addressOf); // address of
144145 TEST_CASE (nullpointerSwitch); // #2626
145146 TEST_CASE (nullpointer_cast); // #4692
@@ -2843,6 +2844,20 @@ class TestNullPointer : public TestFixture {
28432844 ASSERT_EQUALS (" " , errout.str ());
28442845 }
28452846
2847+ void nullpointer102 ()
2848+ {
2849+ check (" struct S { std::string str; };\n " // #11534
2850+ " struct T { S s; };\n "
2851+ " struct U { T t[1]; };\n "
2852+ " void f(const T& t, const U& u, std::string& str) {\n "
2853+ " if (str.empty())\n "
2854+ " str = t.s.str;\n "
2855+ " else\n "
2856+ " str = u.t[0].s.str;\n "
2857+ " }\n " );
2858+ ASSERT_EQUALS (" " , errout.str ());
2859+ }
2860+
28462861 void nullpointer_addressOf () { // address of
28472862 check (" void f() {\n "
28482863 " struct X *x = 0;\n "
You can’t perform that action at this time.
0 commit comments