parent
9d6e5c2a05
commit
d05e43ce15
|
@ -3318,7 +3318,7 @@ bool FwdAnalysis::possiblyAliased(const Token *expr, const Token *startToken) co
|
|||
const bool pure = false;
|
||||
const bool followVar = false;
|
||||
for (const Token *tok = startToken; tok; tok = tok->previous()) {
|
||||
if (tok->str() == "{" && tok->scope()->type == Scope::eFunction)
|
||||
if (tok->str() == "{" && tok->scope()->type == Scope::eFunction && !(tok->astParent() && tok->astParent()->str() == ","))
|
||||
break;
|
||||
|
||||
if (Token::Match(tok, "%name% (") && !Token::Match(tok, "if|while|for")) {
|
||||
|
|
|
@ -141,6 +141,7 @@ private:
|
|||
TEST_CASE(localvaralias16);
|
||||
TEST_CASE(localvaralias17); // ticket #8911
|
||||
TEST_CASE(localvaralias18); // ticket #9234 - iterator
|
||||
TEST_CASE(localvaralias19); // ticket #9828
|
||||
TEST_CASE(localvarasm);
|
||||
TEST_CASE(localvarstatic);
|
||||
TEST_CASE(localvarextern);
|
||||
|
@ -4388,6 +4389,21 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void localvaralias19() { // #9828
|
||||
functionVariableUsage("void f() {\n"
|
||||
" bool b0{}, b1{};\n"
|
||||
" struct {\n"
|
||||
" bool* pb;\n"
|
||||
" int val;\n"
|
||||
" } Map[] = { {&b0, 0}, {&b1, 1} };\n"
|
||||
" b0 = true;\n"
|
||||
" for (auto & m : Map)\n"
|
||||
" if (m.pb && *m.pb)\n"
|
||||
" m.val = 1;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void localvarasm() {
|
||||
|
||||
functionVariableUsage("void foo(int &b)\n"
|
||||
|
|
Loading…
Reference in New Issue