Use Variable::valueType instead of Variable::typeStartToken in auto variables
This commit is contained in:
parent
2beeca3ca2
commit
cde63c7573
|
@ -73,7 +73,7 @@ static bool isRefPtrArg(const Token *tok)
|
|||
static bool isNonReferenceArg(const Token *tok)
|
||||
{
|
||||
const Variable *var = tok->variable();
|
||||
return (var && var->isArgument() && !var->isReference() && (var->isPointer() || var->typeStartToken()->isStandardType() || var->type()));
|
||||
return (var && var->isArgument() && !var->isReference() && (var->isPointer() || var->valueType()->type >= ValueType::Type::CONTAINER || var->type()));
|
||||
}
|
||||
|
||||
static bool isAutoVar(const Token *tok)
|
||||
|
|
|
@ -274,6 +274,11 @@ private:
|
|||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (style) Assignment of function parameter has no effect outside the function.\n", errout.str());
|
||||
|
||||
check("void foo(std::string s) {\n"
|
||||
" s = foo(b);\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (style) Assignment of function parameter has no effect outside the function.\n", errout.str());
|
||||
|
||||
check("void foo(char* p) {\n" // don't warn for self assignment, there is another warning for this
|
||||
" p = p;\n"
|
||||
"}");
|
||||
|
|
Loading…
Reference in New Issue