This commit is contained in:
parent
fb89a2c742
commit
e073860e62
|
@ -778,7 +778,7 @@ void CheckClass::initializeVarList(const Function &func, std::list<const Functio
|
|||
}
|
||||
|
||||
// Calling member variable function?
|
||||
if (Token::Match(ftok->next(), "%var% . %name% (")) {
|
||||
if (Token::Match(ftok->next(), "%var% . %name% (") && !(ftok->next()->valueType() && ftok->next()->valueType()->pointer)) {
|
||||
for (const Variable &var : scope->varlist) {
|
||||
if (var.declarationId() == ftok->next()->varId()) {
|
||||
/** @todo false negative: we assume function changes variable state */
|
||||
|
|
|
@ -179,6 +179,7 @@ private:
|
|||
TEST_CASE(uninitVar31); // ticket #8271
|
||||
TEST_CASE(uninitVar32); // ticket #8835
|
||||
TEST_CASE(uninitVar33); // ticket #10295
|
||||
TEST_CASE(uninitVar34); // ticket #10841
|
||||
TEST_CASE(uninitVarEnum1);
|
||||
TEST_CASE(uninitVarEnum2); // ticket #8146
|
||||
TEST_CASE(uninitVarStream);
|
||||
|
@ -2822,6 +2823,15 @@ private:
|
|||
ASSERT_EQUALS("[test.cpp:8]: (warning) Member variable 'B::x' is not initialized in the constructor.\n", errout.str());
|
||||
}
|
||||
|
||||
void uninitVar34() { // ticket #10841
|
||||
check("struct A { void f() {} };\n"
|
||||
"struct B {\n"
|
||||
" B() { a->f(); }\n"
|
||||
" A* a;\n"
|
||||
"};\n");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (warning) Member variable 'B::a' is not initialized in the constructor.\n", errout.str());
|
||||
}
|
||||
|
||||
void uninitVarArray1() {
|
||||
check("class John\n"
|
||||
"{\n"
|
||||
|
|
Loading…
Reference in New Issue