Fixed #9195 (False positive: shadowFunction when constructor is shadowed)
This commit is contained in:
parent
e93959186e
commit
da6e0308c5
|
@ -2944,7 +2944,7 @@ static const Token *findShadowed(const Scope *scope, const std::string &varname,
|
|||
return var.nameToken();
|
||||
}
|
||||
for (const Function &f : scope->functionList) {
|
||||
if (f.name() == varname)
|
||||
if (f.type == Function::Type::eFunction && f.name() == varname)
|
||||
return f.tokenDef;
|
||||
}
|
||||
if (scope->type == Scope::eLambda)
|
||||
|
|
|
@ -8316,6 +8316,9 @@ private:
|
|||
|
||||
check("void f(int x) { int x; }");
|
||||
ASSERT_EQUALS("[test.cpp:1] -> [test.cpp:1]: (style) Local variable 'x' shadows outer argument\n", errout.str());
|
||||
|
||||
check("class C { C(); void foo() { static int C = 0; } }"); // #9195 - shadow constructor
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void constArgument() {
|
||||
|
|
Loading…
Reference in New Issue