Skip to content

Commit d99d065

Browse files
Update testconstructors.cpp
1 parent 7e600c3 commit d99d065

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/testconstructors.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4165,6 +4165,18 @@ class TestConstructors : public TestFixture {
41654165
" std::map<int, int>* pMap = nullptr;\n"
41664166
"};\n");
41674167
ASSERT_EQUALS("", errout_str());
4168+
4169+
check("struct S {\n" // #6294
4170+
" S() : r(new int) {\n"
4171+
" *p = 0;\n"
4172+
" *(q) = 1;\n"
4173+
" *r = 2;\n"
4174+
" }\n"
4175+
" int *p, *q, *r;\n"
4176+
"};\n");
4177+
ASSERT_EQUALS("[test.cpp:2:5]: (warning) Member variable 'S::p' is not initialized in the constructor. [uninitMemberVar]\n"
4178+
"[test.cpp:2:5]: (warning) Member variable 'S::q' is not initialized in the constructor. [uninitMemberVar]\n",
4179+
errout_str());
41684180
}
41694181

41704182
void uninitConstVar() {

0 commit comments

Comments
 (0)