diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index ec6c00b8dc4..44a6207d749 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -1084,13 +1084,11 @@ void CheckClass::initializeVarList(const Function &func, std::list* pMap = nullptr;\n" "};\n"); ASSERT_EQUALS("", errout_str()); + + check("struct S {\n" // #6294 + " S() : r(new int) {\n" + " *p = 0;\n" + " *(q) = 1;\n" + " *r = 2;\n" + " }\n" + " int *p, *q, *r;\n" + "};\n"); + ASSERT_EQUALS("[test.cpp:2:5]: (warning) Member variable 'S::p' is not initialized in the constructor. [uninitMemberVar]\n" + "[test.cpp:2:5]: (warning) Member variable 'S::q' is not initialized in the constructor. [uninitMemberVar]\n", + errout_str()); } void uninitConstVar() {