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