parent
9b3b477765
commit
1b5b74d1f3
|
@ -3737,7 +3737,7 @@ void CheckOther::checkKnownArgument()
|
|||
continue;
|
||||
if (!Token::Match(tok->astParent(), "(|{|,"))
|
||||
continue;
|
||||
if (tok->astParent()->isCast())
|
||||
if (tok->astParent()->isCast() || (tok->isCast() && Token::Match(tok->astOperand2(), "++|--|%assign%")))
|
||||
continue;
|
||||
int argn = -1;
|
||||
const Token* ftok = getTokenArgumentFunction(tok, argn);
|
||||
|
|
|
@ -635,7 +635,7 @@ static void setTokenValue(Token* tok,
|
|||
// Ensure that the comma isn't a function call
|
||||
if (!callParent || (!Token::Match(callParent->previous(), "%name%|> (") && !Token::simpleMatch(callParent, "{") &&
|
||||
(!Token::Match(callParent, "( %name%") || settings->library.isNotLibraryFunction(callParent->next())) &&
|
||||
!(callParent->str() == "(" && (Token::simpleMatch(callParent->astOperand1(), "*") || Token::Match(callParent->astOperand1(), "%name%"))))) {
|
||||
!(callParent->str() == "(" && (Token::simpleMatch(callParent->astOperand1(), "*") || Token::Match(callParent->astOperand1(), "%name%|("))))) {
|
||||
setTokenValue(parent, std::move(value), settings);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -11074,6 +11074,17 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("struct S { void operator()(int, int); };\n"
|
||||
"void f(int i) {\n"
|
||||
" S()(i, 1);\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("void f(int& r) {\n"
|
||||
" g(static_cast<char>(r = 42));\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("struct S { int i; };\n"
|
||||
"void f(int i) {\n"
|
||||
" const int a[] = { i - 1 * i, 0 };\n"
|
||||
|
|
Loading…
Reference in New Issue