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)) {
|
while (tok && !Token::simpleMatch(tok, ";") && !isScopeBracket(tok)) {
|
||||||
if (tok->str() == ",")
|
if (tok->str() == ",")
|
||||||
++argnr;
|
++argnr;
|
||||||
else if (tok->str() == ")")
|
else if (Token::Match(tok, ")|}"))
|
||||||
tok = tok->link();
|
tok = tok->link();
|
||||||
else if (Token::Match(tok->previous(), "%name% (|{"))
|
else if (Token::Match(tok->previous(), "%name% (|{"))
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -3216,6 +3216,19 @@ private:
|
||||||
" return 1;\n"
|
" return 1;\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
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() {
|
void alwaysTrueContainer() {
|
||||||
|
|
Loading…
Reference in New Issue