Fix issue 9319: FP knownConditionTrueFalse related to aggregate initialization of struct (#2147)
This commit is contained in:
parent
9e140831eb
commit
70cad280ea
|
@ -991,7 +991,7 @@ bool isVariableChangedByFunctionCall(const Token *tok, int indirect, const Setti
|
|||
while (tok && !Token::simpleMatch(tok, ";") && !isScopeBracket(tok)) {
|
||||
if (tok->str() == ",")
|
||||
++argnr;
|
||||
else if (tok->str() == ")")
|
||||
else if (Token::Match(tok, ")|}"))
|
||||
tok = tok->link();
|
||||
else if (Token::Match(tok->previous(), "%name% (|{"))
|
||||
break;
|
||||
|
|
|
@ -3216,6 +3216,19 @@ private:
|
|||
" return 1;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// #9319
|
||||
check("struct S {\n"
|
||||
" int a;\n"
|
||||
" int b;\n"
|
||||
"};\n"
|
||||
"void g(S s, bool& x);\n"
|
||||
"void f() {\n"
|
||||
" bool x = false;\n"
|
||||
" g({0, 1}, x);\n"
|
||||
" if (x) {}\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void alwaysTrueContainer() {
|
||||
|
|
Loading…
Reference in New Issue