File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -569,7 +569,14 @@ class TestUninitVar : public TestFixture {
569569 " std::cout << *p << 1;\n "
570570 " }" );
571571 ASSERT_EQUALS (" [test.cpp:3:17]: (error) Uninitialized variable: p [legacyUninitvar]\n " , errout_str ());
572- }
572+ }
573+
574+ checkUninitVar (" void f() {\n " // #13908
575+ " int* i = new int;\n "
576+ " std::cout << i << \" , \" << *i;\n "
577+ " delete i;\n "
578+ " }\n " ;
579+ ASSERT_EQUALS (" [test.cpp:3:32]: (error) Memory is allocated but not initialized: i [uninitdata]\n " , errout_str ());
573580 }
574581
575582 // #8494 : Overloaded & operator
@@ -3163,21 +3170,13 @@ class TestUninitVar : public TestFixture {
31633170 ASSERT_EQUALS (" " , errout_str ());
31643171 }
31653172
3166- void uninitvar12 () {
3167- const char code[] = " void fp() {\n " // 10218
3173+ void uninitvar12 () { // 10218
3174+ const char code[] = " void fp() {\n "
31683175 " std::stringstream ss;\n "
31693176 " for (int i; ss >> i;) {}\n "
31703177 " }" ;
31713178 checkUninitVar (code);
31723179 ASSERT_EQUALS (" " , errout_str ());
3173-
3174- const char code2[] = " void f() {\n " // #13908
3175- " int* i = new int;\n "
3176- " std::cout << i << \" , \" << *i;\n "
3177- " delete i;\n "
3178- " }\n " ;
3179- checkUninitVar (code2);
3180- ASSERT_EQUALS (" [test.cpp:3:32]: (error) Memory is allocated but not initialized: i [uninitdata]\n " , errout_str ());
31813180 }
31823181
31833182 void uninitvar13 () { // #9772 - FP
You can’t perform that action at this time.
0 commit comments