Fixed #8466 (False Positive: Member variable is not initialized in the constructor. When using overloaded constructors) (#1141)
This commit is contained in:
parent
b4583d6e37
commit
2a418fa0f5
|
@ -1210,7 +1210,7 @@ void SymbolDatabase::createSymbolDatabaseSetFunctionPointers(bool firstPass)
|
|||
for (std::list<Scope>::iterator it = scopeList.begin(); it != scopeList.end(); ++it) {
|
||||
for (std::list<Function>::const_iterator func = it->functionList.begin(); func != it->functionList.end(); ++func) {
|
||||
// look for initializer list
|
||||
if (func->type == Function::eConstructor && func->functionScope && func->functionScope->functionOf && func->arg) {
|
||||
if (func->isConstructor() && func->functionScope && func->functionScope->functionOf && func->arg) {
|
||||
const Token * tok = func->arg->link()->next();
|
||||
if (tok->str() == "noexcept") {
|
||||
const Token * closingParenTok = tok->linkAt(1);
|
||||
|
|
|
@ -6199,6 +6199,15 @@ private:
|
|||
" }\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
checkInitializationListUsage("class Bar {\n" // #8466
|
||||
"public:\n"
|
||||
" explicit Bar(const Bar &bar) : Bar{bar.s} {}\n"
|
||||
" explicit Bar(const char s) : s{s} {}\n"
|
||||
"private:\n"
|
||||
" char s;\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue